ModalPopupExtender不在aspx中显示

时间:2018-10-03 12:38:13

标签: asp.net ajaxcontroltoolkit toolkitscriptmanager

我尝试在我的aspx页面中设计一个弹出窗口。问题是页面已重新加载,弹出窗口未显示!

这是代码

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();
    }

我尝试使用“ ToolkitScriptManager”,但未知!

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

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

1 个答案:

答案 0 :(得分:0)

我看到一个问题,

在ModalPopupExtender中替换 PopupControlID 属性,

xlsx

收件人

PopupControlID="panel1"

面板ID是panel1,而不是panel1。

此外,Panel应该没有显示样式(PopupControlID="panet1"),但是您可以根据需要进行保留。