【问题标题】:close Bootstrap Modal after click button inside model单击模型内的按钮后关闭 Bootstrap Modal
【发布时间】:2016-07-15 03:23:41
【问题描述】:

在我的 asp 页面中,我有以下内容:

 <ContentTemplate> <div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
     <asp:UpdatePanel ID="upModal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
        <ContentTemplate>
            <div class="modal-content">
                 <div class="modal-header">
                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                     <h4 class="modal-title"><asp:Label ID="lblModalTitle" runat="server" Text=""></asp:Label></h4>
                 </div>
                 <div class="modal-body">
                     <asp:Label ID="lblModalBody" runat="server" Text=""></asp:Label>
                 </div>
                 <div class="modal-footer">
                   <asp:Button runat="server" ID="btnSavedata" CssClass="btn btn-info"> Text="Save"/>

                    <button class="btn btn-info" data-dismiss="modal" aria-hidden="true">Close</button>
                 </div>
             </div>
         </ContentTemplate>
   </asp:UpdatePanel>
 </div> </div>

我还有另一个链接可以从后面的代码中显示 Modal

Protected Sub btn_DeleteQuote_ServerClick(sender As Object, e As EventArgs) Handles btn_PrintQuote.ServerClick

lblModalTitle.Text = "Validation Errors List for HP7 Citation"
lblModalBody.Text = "This is modal body"
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal({backdrop:'static', keyboard: false});", True)
upModal.Update()

结束子

现在我想当我点击按钮 btnSavedata(这个按钮在模式内)时我想更新我的页面内的一些内容(这个内容在模式外)然后关闭模式 我希望在 btnSavedata_click 事件上使用代码

【问题讨论】:

  • 请正确解释你的问题,不是很清楚!!!
  • 我刚刚给了你一个答案,如果你需要任何帮助,你可以评论并解释你的问题
  • 我的问题是我想在点击保存按钮后使用代码隐藏关闭我的模式。
  • 任何人都可以帮助我
  • 点击保存按钮后你想做什么?

标签: asp.net modal-dialog bootstrap-modal


【解决方案1】:

使用此代码:

ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal('hide');", True)

【讨论】:

    【解决方案2】:
    [http://www.w3schools.com/bootstrap/bootstrap_modal.asp][1]
    

    Asp.net Modal的完美例子

    http://www.w3schools.com/bootstrap/bootstrap_modal.asp

    <button type="button" class="btn btn-default" data-dismiss="modal">SAVE</button>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-26
      • 2017-03-01
      • 1970-01-01
      • 2014-01-01
      • 2019-04-26
      • 2014-12-05
      • 2021-07-11
      • 1970-01-01
      相关资源
      最近更新 更多