Javascript 与OnServerClick ASP.net一起使用时,启动模式在按钮单击时关闭

Javascript 与OnServerClick ASP.net一起使用时,启动模式在按钮单击时关闭,javascript,c#,jquery,asp.net,twitter-bootstrap,Javascript,C#,Jquery,Asp.net,Twitter Bootstrap,我们需要使用bootstrap.css在我们的asp.net应用程序中,我们遇到了一个modals问题,当我们单击搜索按钮时,modals会关闭 下面是放置在模式下的按钮,id为“modal1” 搜索 一个可能的解决方案是,当控件返回时,我可以执行$(“#modal1”).modal()。但有了这个解决方案,我的模式会刷新,每次单击搜索按钮时都会闪烁 有人能帮我刷新模式数据吗。你必须使用Ajax概念。 我希望这能对你有所帮助 <form id="form1" runat="server

我们需要使用bootstrap.css在我们的asp.net应用程序中,我们遇到了一个modals问题,当我们单击搜索按钮时,modals会关闭

下面是放置在模式下的按钮,id为“modal1”


搜索
一个可能的解决方案是,当控件返回时,我可以执行
$(“#modal1”).modal()
。但有了这个解决方案,我的模式会刷新,每次单击搜索按钮时都会闪烁


有人能帮我刷新模式数据吗。

你必须使用Ajax概念。 我希望这能对你有所帮助

<form id="form1" runat="server">
 <asp:ScriptManager ID="ScriptManager1" runat="server">
 </asp:ScriptManager>
<asp:Button ID="btnShow" runat="server" Text="Show Modal Popup" />

<!-- ModalPopupExtender -->
<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panel1" TargetControlID="btnShow" CancelControlID="btnClose" ackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center"   style = "display:none">
This is an ASP.Net AJAX ModalPopupExtender Example<br />
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>
<!-- ModalPopupExtender -->
</form>

这是一个ASP.Net AJAX ModalPopupXtender示例

我想我可能会遇到你的问题,你应该试试

$("#button-id").on("click",function(){
    //code
});

如果模态仍然关闭,请将此代码放在上述函数的末尾。
$(“#modal1”).modal('show')

,那么您希望在模态关闭时更改数据吗?
$("#button-id").on("click",function(){
    //code
});