Masterpage Code Behind Not Seeing Ajax Control Tool Kit Objects on Masterpage RRS feed

  • Question

  • User682008122 posted

    I'm not sure if this is the correct forum, so please move if needed. I have a C# project that was built and working correctly in VS 2015. I had to move the code to a new server and we found that we couldn't run the application in debug (we couldn't get localhost to access it). We also realized it was originally built by plagiarizing another application that was migrated from vs2008 to vs2010 to vs2015. It originally was debugable on vs2015 on the original server. We verified localhost was working correctly by building a new basic app. Needed to get this background out so you understand where we stand. Now we are trying to create a new app from scratch by starting a new project and slowly bringing in each page, codebehind, classes, etc. The issue we are having is that the MasterPage code behind is not seeing the AjaxControlToolkit objects from the MasterPage. At first we were not seeing anything so we changed the "CodeFile" to "Code"Behind" on the MasterPage. Once we did this the .designer incorporated the asp: controls. So now were stuck on the AjaxControlToolkit items.  Here are some code snippets:


    <%@ Master Language="C#" AutoEventWireup="true" Codebehind="Measures.master.cs"  Inherits="Test.Measures" %>
      <ajaxToolkit:ModalPopupExtender ID="ModalDefinitions" runat="server"

    Code Behind:

    namespace Test
        public partial class Measures : System.Web.UI.MasterPage
    protected void HiddenDefinitionsButton_Click(object sender, EventArgs e)//Handles javascript calls for client viewing of popups

    The ModalDefinitions is underlined and giving the error: The 'ModalDefinitions' does not exist in the current context.

    I made sure the AjaxControlToolkit was installed and even ensured it was referenced by the project.

    What should I be doing to get it to work?

    Friday, February 14, 2020 6:46 PM


All replies

  • User1535942433 posted

    Hi  Whalensdad,

    Accroding to your codes,I create a demo and it's work fine. I suggest you could check:

    the designer whether have AjaxControlToolkit,just like this:

            protected global::AjaxControlToolkit.ModalPopupExtender ModalDefinitions;

     And you could drag the modalpopupextender control again.

    More details,you could refer to below article:


    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 17, 2020 3:38 AM
  • User682008122 posted

    And you could drag the modalpopupextender control again.

    Thanks YiJing - Dragging the extender back in was the fix. Why this stuff doesn't work automatically is baffling.


    Monday, February 17, 2020 1:00 PM