2013-07-30 74 views
0

我使用twitter引導模式與Asp.net Webforms。Twitter引導模式與Asp.net Webforms消失

事件發生後點擊按鈕btn提交,模態消失。

如何保持模態有效?

Example.aspx:

<form id="form1" runat="server"> 
<div> 
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>  
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
<ContentTemplate> 
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> 
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
<asp:TextBox ID="txtMessage" runat="server"></asp:TextBox> 
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
<asp:Button CssClass="btn btn-primary" ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> 
</div> 
</ContentTemplate> 
</asp:UpdatePanel> 
</div> 
</form> 

Example.aspx.cs

protected void btnSubmit_Click(object sender, EventArgs e) 
{ 
txtMessage.Text = "Success!"; 
} 

回答

0

您需要將您的UpdatePanel標籤;目前您擁有它們的地方是您將整個模式放在您需要僅包含模式內容的地方。

例如:

<form id="form1" runat="server"> 
<div> 
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> 
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">  
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
<ContentTemplate> 
<asp:TextBox ID="txtMessage" runat="server"></asp:TextBox> 
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> 
<asp:Button CssClass="btn btn-primary" ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> 
</ContentTemplate> 
</asp:UpdatePanel> 
</div> 
</div> 
</form>