如何在ajax modalpopupextender中显示gridview ?
本文关键字:显示 gridview modalpopupextender ajax | 更新日期: 2023-09-27 17:50:39
我不知道如何使它工作......我正在使用ASP.net和c#,我正在设计一个搜索用户控件
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="btnFind" CancelControlID="btnCancel" PopupControlID="Panel"
PopupDragHandleControlID="Panel" BackgroundCssClass="modalBackground" </asp:ModalPopupExtender>
<asp:Panel ID="Panel" runat="server" CssClass="ModalWindow">
<asp:GridView ID="grdInfo" runat="server" >
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="Select" Text="Button" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
我有一个类似的ModalPopup,它像一个魅力,即使异步回发。它是一个用户控件的一部分,因此我只显示相关的部分(减少)+你的GridView。如果你告诉我你到底有什么问题,那就好办了。在哪里将网格绑定到它的数据源?
<asp:ModalPopupExtender ID="ChargeFilterModalDialogExtender" runat="server" TargetControlID="BtnShowDialog" CancelControlID="BtnCloseChargeFilterControl" Drag="false" PopupControlID="Dialog_ChargeFilter" Enabled="True" BackgroundCssClass="modalBackground" />
<asp:Button ID="BtnShowDialog" Style="display: none" runat="server" Width="120" Text="Filter Charges" ToolTip="show Chargefilter-Dialog" />
<asp:Panel id="Dialog_ChargeFilter" CssClass="modalPopup" runat="server" >
<asp:Panel ID="DialogHeaderFrame" CssClass="DialogHeaderFrame" runat="server">
<asp:Panel ID="DialogHeader" runat="server" CssClass="DialogHeader" >
<asp:Label ID="LblPopupHeader" runat="server" Text="Charge-Filter">
</asp:Panel>
</asp:Panel>
<asp:UpdatePanel ID="UpdGrdCharge" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false" >
<ContentTemplate>
<asp:Button ClientIDMode="Static" ID="BtnCloseChargeFilterControl" Text="close filter" ToolTip="close filter-dialog" CausesValidation="false" Width="150px" runat="server" /><br />
<asp:GridView ID="grdInfo" runat="server" >
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="Select" Text="Button" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
这是我的CSS(应该是不相关的,只是为了完整性):
.modalBackground
{
background-color:silver;
filter: alpha(opacity=60);
opacity: 0.6;
}
.modalPopup
{
background-color:White;
border: 1px solid #4C3C1B;
padding: 5px;
}
.DialogHeader
{
background-color:#002D64;
color:White;
height:30px;
font-size:medium;
font-style:normal;
font-weight:bold;
vertical-align:middle;
display: table-cell;
}
.DialogHeaderFrame
{
width:100%;
cursor:default;
background-color:white;
display:table;
}
你们需要手动更新面板吗?这是我唯一能让我的工作的方法。当我点击图像按钮时它会隐藏弹出窗口我需要输入
gridview.databind()
updatepanel.update()
popup.show()
我做错什么了吗?