我有一个模态弹出窗口,从LinkButton
内的GridView
启动。
在Modal Popup中有3 TextBox
和3 GridView
。用户从GridView
行中选择项目,然后在文本框中填充这些项目。
当用户选择GridView
行时,模式弹出窗口将关闭。如果再次打开模态弹出窗口,则会填充TextBox
,但我需要模态弹出窗口保持打开状态。
主页Gridview
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
OnRowDataBound="GridView1_RowDataBound" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name"
HtmlEncode="true" />
<asp:BoundField DataField="Order" HeaderText="Order"
HtmlEncode="true" />
<asp:BoundField DataField="Drinks" HeaderText="Drinks"
HtmlEncode="true" />
<asp:BoundField DataField="Comments" HeaderText="Comments"
HtmlEncode="true" />
<asp:CommandField ShowSelectButton="true" ButtonType="Link"
Visible="false" SelectText="Enroll" />
<asp:TemplateField ItemStyle-Width="60px">
<ItemTemplate>
<asp:LinkButton ID="lnkEdit" runat="server"
Text="Add Lunch" OnClick="Edit"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
主页模态弹出
<asp:Panel ID="Panel2" runat="server" class="modalPopup" Style="display: none">
<table>
<tr>
<td>
<asp:Label ID="Header" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td valign="top">
<asp:Label ID="Label1" runat="server" Text="Order"></asp:Label>
</td>
<td valign="top">
<asp:Label ID="Label2" runat="server" Text="Drinks">
</asp:Label>
</td>
<td valign="top">
<asp:Label ID="Label3" runat="server" Text="Comments">
</asp:Label>
</td>
</tr>
<tr>
<td valign="top">
<asp:TextBox ID="txtOrder" runat="server" Rows="3"
TextMode="MultiLine" Width="100%"></asp:TextBox>
</td>
<td valign="top">
<asp:TextBox ID="txtDrinks" runat="server" Rows="3"
TextMode="MultiLine"></asp:TextBox>
</td>
<td valign="top">
<asp:TextBox ID="txtComments" runat="server" Rows="3"
TextMode="MultiLine"></asp:TextBox>
<asp:TextBox ID="txtName" runat="server" Visible="false">
</asp:TextBox>
<asp:TextBox ID="txtDate" runat="server" Visible="false">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Order History
</td>
</tr>
<tr>
<td valign="top">
<asp:GridView ID="gvOrder" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
AutoGenerateColumns="false"
OnSelectedIndexChanged="gvOrder_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="Order" HeaderText="Order"
HtmlEncode="true" />
<asp:CommandField SelectText="Add To Order"
ShowSelectButton="True" />
</Columns>
</asp:GridView>
</td>
<td valign="top">
<asp:GridView ID="gvDrinks" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
AutoGenerateColumns="false"
OnSelectedIndexChanged="gvDrinks_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="Drinks" HeaderText="Drinks"
HtmlEncode="true" />
<asp:CommandField SelectText="Add To Order"
ShowSelectButton="True" />
</Columns>
</asp:GridView>
</td>
<td valign="top">
<asp:GridView ID="gvComments" runat="server" CssClass="mGrid"
AlternatingRowStyle-CssClass="alt"
AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Comments"
HeaderText="Comments"
HtmlEncode="true" />
<asp:CommandField SelectText="Add To Order"
ShowSelectButton="True" />
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<div class="popup_Buttons">
<asp:Button ID="Okaybtn" runat="server" Text="Done"
OnClick="Save" />
<input id="Button1" type="button" value="Cancel" />
</div>
</td>
</tr>
</table>
</asp:Panel>
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<cc1:ModalPopupExtender ID="popup" runat="server" DropShadow="false"
PopupControlID="Panel2" TargetControlID="btnShowPopup"
BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
任何人都可以阐明为什么会发生这种情况以及我可以做些什么来绕过它? 如果您需要查看一些代码隐藏,请告诉我。
提前致谢!
答案 0 :(得分:0)
有点晚了,但你可以打电话
modalPopupExpander.Show();
可能的方法是注册模态内容页面的事件。