简体   繁体   中英

ModalPopupExtender does not show in aspx

i try to design a popup window in my aspx page. The problem is the page is reloaded and the popup not shown!

here is the code

aspx

<asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager>
    <asp:Label ID="popuplbl" runat="server"></asp:Label>

    <cc1:ModalPopupExtender ID="mpe" PopupControlID="panel1" TargetControlID="popuplbl" CancelControlID="cancelbtn" runat="server"></cc1:ModalPopupExtender>

    <asp:Panel ID="panet1" class="modal fade in" runat="server">

            <div class="modal-dialog">
                 <div class="modal-content">
                      <div class="modal-header">
                           <button class="close" aria-hidden="true" type="button" data-dismiss="modal"></button>
                           <h4 class="modal-title">New Study Design</h4>
                      </div>
                      <div class="modal-body">
                           <div class="row">
                                <div class="col-md-12">
                                      <h4>Some Input</h4>
                                      <p><input class="col-md-12 form-control" type="text"> </p>
                                      <p><input class="col-md-12 form-control" type="text"> </p>
                                 </div>
                           </div>
                       </div>
                       <div class="modal-footer">
                           <button id="cancelbtn" class="btn default" type="button" data-dismiss="modal">Cancel</button>
                           <button class="btn blue" type="button">Add</button>
                       </div>
                  </div>
           </div>

     </asp:Panel>


<button runat="server" id="AddNew_StudyDesign" class="btn sbold green" title="Add New Study Design" style="width:200px" onserverclick="AddNew_StudyDesign_Click" >
                                        Add New Study Design <i class="fa fa-plus"></i>
                                </button>

c#

protected void AddNew_StudyDesign_Click(object sender, System.EventArgs e)
    {
        mpe.Show();
    }

I try using "ToolkitScriptManager" but it is not known!

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<cc1:ToolkitScriptManager ID="ScriptManager1" runat="server" />

I can see one issue,

Replace PopupControlID attribute in ModalPopupExtender ,

PopupControlID="panel1"

To

PopupControlID="panet1"

Panel ID is panet1, not panel1.

Additionally, Panel should have display style none ( style="display:none;" ), but you can keep as per your requirements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM