如果按钮放在Asp.Net的UpdatePanel中,则Bootstrap Modal不会按下按钮

时间:2017-02-18 19:16:41

标签: jquery bootstrap-modal

    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
            <script src="Files/Bootstrap/jquery-3.1.1.min.js" type="text/javascript"></script>
            <script src="Files/Bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
            <link href="Files/Bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
            </asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

                <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>

                <asp:Button ID="Button1" runat="server" Text="TEST1" BackColor="#4AAF51" Width="200px" class="btn btn-info btn-lg" OnClick="GetPop" />

                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">       
                    <ContentTemplate>
    <asp:Button ID="Button2" runat="server" Text="TEST2" BackColor="#4AAF51" Width="200px" class="btn btn-info btn-lg" OnClick="GetPop" />

                <div id="getpopup" class="modal fade" role="dialog">
              <div class="modal-dialog">

                <!-- Modal content-->
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Modal Header</h4>
                  </div>
                  <div class="modal-body">
                    <p>Test modal.</p>
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                  </div>
                </div>

              </div>
            </div>
                 </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Content>

代码隐藏:

protected void GetPop(object sender, EventArgs e)
        {
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "g1", "$('#getpopup').modal();", true);
        }

我的问题:
    我用了两个按钮,即; TEST1(在updatepanel之外)和TEST2(在updatepanel内)。当我点击TEST1时会出现弹出窗口,但是当我点击放置在updatepanel中的TEST2按钮时,弹出窗口不会出现。有什么区别,如何在TEST2按钮上单击显示弹出窗口?我使用过Bootstrap Modal Popup。     任何人都可以帮忙...

0 个答案:

没有答案