更新面板内弹出的模式没有响应
<asp:ModalPopupExtender ID="MPE_EditGroup" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlpopup" DropShadow="true" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlpopup" runat="server" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<table width="100%" style="border: Solid 3px #980000; width: 470px; height: 370px;"
cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<asp:ListBox ID="lst_allmembers" SelectionMode="Multiple" Width="120px" ToolTip="Press ctrl to select multiple users"
DataValueField="FirstName" runat="server"></asp:ListBox>
<asp:Button ID="btn_Add" runat="server" Text="Add User" OnClick="btn_Add_Click" />
</td>
<td align="center">
<asp:ListBox ID="lst_grpmembers" DataValueField="Name" SelectionMode="Multiple" Width="120px"
ToolTip="Press ctrl to select multiple users" runat="server"></asp:ListBox>
<asp:Button ID="btn_remove" runat="server" Text="Remove User" OnClick="btn_Remove_Click" />
</td>
</tr>
<tr><td></td><td></td></tr>
<tr>
<td align="right">
<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" OnClick="btnUpdate_Click" />
</td>
<td align="left">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="Cancel_Click" />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_Add" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btn_remove" EventName="Click" />
</Triggers>
</asp:UpdatePanel><asp:Panel>
我在更新面板中有这个表,添加和删除工作正常,但更新按钮没有响应,但代码被执行,一切都很好。但它必须关闭模式弹出窗口并显示警报,但它没有发生。如果我在单击更新按钮时进行重定向,它就会起作用。但我想显示一个警报,然后绑定表。应该做什么
更新代码隐藏
Page.ClientScript.RegisterStartupScript(GetType(), "UserDialogScript", "alert(\"Group successfully updated\");", true);
BindGridView(Session["useremail"].ToString());
<asp:ModalPopupExtender ID="MPE_EditGroup" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlpopup" DropShadow="true" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlpopup" runat="server" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<table width="100%" style="border: Solid 3px #980000; width: 470px; height: 370px;"
cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<asp:ListBox ID="lst_allmembers" SelectionMode="Multiple" Width="120px" ToolTip="Press ctrl to select multiple users"
DataValueField="FirstName" runat="server"></asp:ListBox>
<asp:Button ID="btn_Add" runat="server" Text="Add User" OnClick="btn_Add_Click" />
</td>
<td align="center">
<asp:ListBox ID="lst_grpmembers" DataValueField="Name" SelectionMode="Multiple" Width="120px"
ToolTip="Press ctrl to select multiple users" runat="server"></asp:ListBox>
<asp:Button ID="btn_remove" runat="server" Text="Remove User" OnClick="btn_Remove_Click" />
</td>
</tr>
<tr><td></td><td></td></tr>
<tr>
<td align="right">
<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" OnClick="btnUpdate_Click" />
</td>
<td align="left">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="Cancel_Click" />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_Add" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btn_remove" EventName="Click" />
</Triggers>
</asp:UpdatePanel><asp:Panel>
I have this table inside the update panel, and the add and remove works fine, but the update button doesnt respond, but the code is executed and everything is fine. but it has to close the modal pop up and display a alert, but it is not happening. If i do redirect when I click the update button it works. but I want to show a alert and then bind the table. what should be done
Code behind for update
Page.ClientScript.RegisterStartupScript(GetType(), "UserDialogScript", "alert(\"Group successfully updated\");", true);
BindGridView(Session["useremail"].ToString());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能在复制时遗漏了一些内容,但
ModalPopupExtender
未正确关闭:至于关闭 Popup 并在单击更新按钮时显示警报,请尝试对更新按钮使用 PostBackTrigger。
这将使按钮执行完整的回发,这将关闭弹出窗口,并允许您在页面重新加载时显示警报。
You might have missed something when copying it, but the
ModalPopupExtender
isn't closed properly:As for closing the Popup and displaying an alert when the update button is clicked, try using a PostBackTrigger for the update button.
This will make the button perform a full postback, which will close the popup, and allow you to show the alert when the page reloads.