简体   繁体   中英

Ajax modalpopup extender not working in asp.net web page

I am using Ajaxmodalpopup extender and when show() method is called inside server side code, nothing happens. Below is the code. The reason I have to use dummy button is that I have to call server side code with TargetControlID and if I use "Add Test" which is the one I desire, the server side code is not called. SO, Once I create dummy button and assign it as TargetControlID, I can call server side code and then use popupAddExtender.Show() to show the popup. Issue is that the pop up is not displayed for some reason. I have tried various options provided at Stack Overflow, but none seems working. Appreciate any help. AjaxControltoolkit version is 15.1.2.0 and .NET Framework is 4.0.0.

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

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

<div>
<asp:Button ID="AddTest" Text="Add Test" runat="server" OnClick="AddTest_Click"   />
</div>

<ajax:ModalPopupExtender ID="popupAddExtender" runat="server" TargetControlID="btndummypopup" PopupControlID="pnlAddTest"></ajax:ModalPopupExtender>

<asp:Panel ID="pnlAddTest" runat="server" style="display:none">
      <div>
      <asp:Label ID="lblTest" runat="server" >Test</asp:Label></div>
      <div><asp:Label ID="lblpopupTestName" runat="server"></asp:Label> 
          <asp:DropDownList ID="ddlTest" runat="server"></asp:DropDownList>
      </div>
      <div><asp:Label ID="lblMeasurement" runat="server">Measurement Date</asp:Label>
            <telerik:RadCalendar RenderMode="Lightweight" ID="radtkMeasurementDate" Width="100%" EnableMultiSelect="false" EnableKeyboardNavigation="true"
                ShowColumnHeaders="true" ShowDayCellToolTips="true" SelectedDate="08/10/2015"  ShowRowHeaders="true" runat="server"
                >

            </telerik:RadCalendar>
      </div>
      <div><asp:Label ID="lblpopupResult" runat="server"> Result</asp:Label>
          <asp:TextBox ID="lblpopupresultvalue" runat="server"></asp:TextBox>
      </div>
      <div><asp:Button ID="btnSave" runat="server" Text="Save"/>
          <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
      </div>
  </asp:Panel>

<div><asp:Button ID="btndummypopup" runat="server" style="display:none" /></div>

Server side code:

protected void AddTest_Click(object sender, EventArgs e) {

        popupAddExtender.Show();
       ddlTest.DataSource=GetTestName();;
       ddlTest.DataValueField = "LabID";
        ddlTest.DataTextField="Name";
        ddlTest.DataBind();

    }

Created an asp.net 4.0 webapp, installed act version 15.1.2.0 from nuget, copied both your markup and code and all worked fine. It could be something related to your CSS styles or some javascript ref/calls are broken. Can you zip and upload your project?

update: used vs2013u up5

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