locked
Error when using an AJAX Calendar Extender in UpdatePanel RRS feed

  • Question

  • User-1033004070 posted

    On my webpage, i have an UpdatePanel that contains an asp:panel Panel and some controls with an Ajax CalendarExtender.  The Panel initially has visibility set to false.  When i select a value from a dropdown, a GridView loads and if the number of rows in the gridview are greater than 0, i set the panel visibility property to true and call the Update method on the UpdatePanel.  When I do this, I receive the following js error:

    0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Extender control 'tbIDMdate_CalendarExtender' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors().
    Parameter name: extenderControl

    I have done a bunch of research and so far nothing has worked.  I'm not sure what to do to get it to work, the error appears when I try to set the visibility property of the Panel to True.  My toolscriptmanager is located in the master page.

    <asp:UpdatePanel ID="updPnlAssignDeliveryMethods" UpdateMode="Conditional" runat="server">
                                   
    <ContentTemplate>
                                       
    <asp:Panel ID="pnlAssignDeliveryMethods" runat="server" Visible="false">
                                           
    <asp:Label ID="Label18" runat="server" Text="IDM Date:"></asp:Label>
                                           
    <asp:TextBox ID="tbIDMdate" runat="server" Width="75px"></asp:TextBox>
                                               
    <ajaxToolkit:CalendarExtender ID="tbIDMdate_CalendarExtender" runat="server" Enabled="True" TargetControlID="tbIDMdate">
                                               
    </ajaxToolkit:CalendarExtender>
                                           
    <asp:Label ID="Label19" runat="server" Text="Delivery Method:"></asp:Label>
                                           
    <asp:Button ID="btnAssignSD" runat="server" CssClass="buttonBlue" OnClick="btnAssignSD_Click" Text="Seat Delivery" />
                                            &nbsp;
    <asp:Button ID="btnAssignSelfDeploy" runat="server" CssClass="buttonBlue" OnClick="btnAssignSelfDeploy_Click" Text="Self Deploy" />
                                            &nbsp;
    <asp:Button ID="btnAssignFS" runat="server" CssClass="buttonBlue" OnClick="btnAssignFS_Click" Text="Field Services" />
                               
                                       
    </asp:Panel>
                                   
    </ContentTemplate>
                               
    </asp:UpdatePanel>

     

    <asp:updatepanel id="updPnlAssignDeliveryMethods" runat="server" updatemode="Conditional"> <contenttemplate> <asp:panel id="pnlAssignDeliveryMethods" runat="server" visible="false"> <asp:label id="Label18" runat="server" text="IDM Date:"></asp:label> <asp:textbox id="tbIDMdate" runat="server" width="75px"></asp:textbox> <ajaxtoolkit:calendarextender id="tbIDMdate_CalendarExtender" runat="server" targetcontrolid="tbIDMdate" enabled="True"> </ajaxtoolkit:calendarextender> <asp:label id="Label19" runat="server" text="Delivery Method:"></asp:label> <asp:button id="btnAssignSD" onclick="btnAssignSD_Click" runat="server" text="Seat Delivery" cssclass="buttonBlue"></asp:button>  <asp:button id="btnAssignSelfDeploy" onclick="btnAssignSelfDeploy_Click" runat="server" text="Self Deploy" cssclass="buttonBlue"></asp:button>  <asp:button id="btnAssignFS" onclick="btnAssignFS_Click" runat="server" text="Field Services" cssclass="buttonBlue"></asp:button> </asp:panel> </contenttemplate> </asp:updatepanel>

    Tuesday, October 7, 2014 8:09 AM

Answers

  • User555306248 posted

    In this scenario, I would like to suggest you remove the Update panels from the user controls, and this issue has been discussed in another thread. Please check the following link for more information:
     
    Strange Error - "Not A Registered Extender Control"
    http://forums.asp.net/p/1078866/2082230.aspx

    Can you place a call to base.RenderControl instead of base.Render? (Or override the Render method instead of RenderControl)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 19, 2014 11:40 PM

All replies

  • User1918509225 posted

    Hi sz56ms01,

    According to your post ,I created a demo to try  to reproduce your issue.

    I created a webpage which Inherits from the master page. and add the toolscriptmanager to the master page .

    It worked very well.

    Here is my master page:

    <html lang="en">
    <head runat="server">
        <meta charset="utf-8" />
        <title><%: Page.Title %> - My ASP.NET Application</title>
        <asp:PlaceHolder runat="server">     
              <%: Scripts.Render("~/bundles/modernizr") %>
        </asp:PlaceHolder>  
        <webopt:BundleReference runat="server" Path="~/Content/css" /> 
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
    </head>
    <body>
        <form runat="server">
            <ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajax:ToolkitScriptManager>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">
                        <a runat="server" href="~/">your logo here</a>
                    </p>
                </div>
                <div class="float-right">
                    <section id="login">
                        <asp:LoginView runat="server" ViewStateMode="Disabled">
                            <AnonymousTemplate>
                                <ul>
                                    <li><a id="registerLink" runat="server" href="~/Account/Register.aspx">Register</a></li>
                                    <li><a id="loginLink" runat="server" href="~/Account/Login.aspx">Log in</a></li>
                                </ul>
                            </AnonymousTemplate>
                            <LoggedInTemplate>
                                <p>
                                    Hello, <a runat="server" class="username" href="~/Account/Manage.aspx" title="Manage your account">
                                        <asp:LoginName runat="server" CssClass="username" /></a>!
                                    <asp:LoginStatus runat="server" LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" />
                                </p>
                            </LoggedInTemplate>
                        </asp:LoginView>
                    </section>
                    <nav>
                        <ul id="menu">
                            <li><a runat="server" href="~/">Home</a></li>
                            <li><a runat="server" href="~/About.aspx">About</a></li>
                            <li><a runat="server" href="~/Contact.aspx">Contact</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
            <asp:ContentPlaceHolder runat="server" ID="FeaturedContent" />
            <section class="content-wrapper main-content clear-fix">
                <asp:ContentPlaceHolder runat="server" ID="MainContent" />
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; <%: DateTime.Now.Year %> - My ASP.NET Application</p>
                </div>
            </div>
        </footer>
        </form>
    </body>
    </html>

    Here is my own page:

    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
          <asp:UpdatePanel ID="updPnlAssignDeliveryMethods" UpdateMode="Conditional" runat="server">
                                     <ContentTemplate>
                                         <asp:Panel ID="pnlAssignDeliveryMethods" runat="server" Visible="false">
                                             <asp:Label ID="Label18" runat="server" Text="IDM Date:"></asp:Label>
                                             <asp:TextBox ID="tbIDMdate" runat="server" Width="75px"></asp:TextBox>
                                                 <ajaxToolkit:CalendarExtender ID="tbIDMdate_CalendarExtender" runat="server" Enabled="True" TargetControlID="tbIDMdate">
                                                 </ajaxToolkit:CalendarExtender>
                                             <asp:Label ID="Label19" runat="server" Text="Delivery Method:"></asp:Label>
                                             <asp:Button ID="btnAssignSD" runat="server" CssClass="buttonBlue" OnClick="btnAssignSD_Click" Text="Seat Delivery" />
                                             &nbsp;<asp:Button ID="btnAssignSelfDeploy" runat="server" CssClass="buttonBlue" OnClick="btnAssignSelfDeploy_Click" Text="Self Deploy" />
                                             &nbsp;<asp:Button ID="btnAssignFS" runat="server" CssClass="buttonBlue" OnClick="btnAssignFS_Click" Text="Field Services" />
                                
                                         </asp:Panel>
                                     </ContentTemplate>
                                 </asp:UpdatePanel>
        </div> </asp:Content>

    I set the panel visible as true when the page load:

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack) {
    
                    pnlAssignDeliveryMethods.Visible = true;
                }
            }

    When I run the page ,click the textbox,it show calendar correctly.

    Please try my code,if it doesn't work,please share your project on onedrive (https://onedrive.live.com/) for me to test .

    Best Regards,

    Kevin Shen.

    Tuesday, October 7, 2014 9:31 PM
  • User-1033004070 posted

    Thank you Kevin.  That does work and it would work the same if I had the updatePanel set to visible all the time.  The problem is, my updatePanel is hidden until I determine that there is data in a gridview and then it is set to visible to be able to take action against checked items in the gridview.

    protected void GridView3_DataBound(object sender, EventArgs e)
            {
                if (GridView3.Rows.Count != 0)
                {
                    pnlAssignDeliveryMethods.Visible = true;
                    updPnlAssignDeliveryMethods.Update();
                }
                else
                {
                    pnlAssignDeliveryMethods.Visible = false;
                    updPnlAssignDeliveryMethods.Update();
                }
            }

     

    Wednesday, October 8, 2014 11:51 AM
  • User1918509225 posted

    Hi sz56ms01,

    When I modified my updatepanel  visible as false  based on my code,then I set it as true in the server side .

    The Ajax Calendar extender work very well.

    I suggest that you can set a breakpoint on your code check which has error message.

    If you still have issue,please share your project on onedrive(http://www.onedrive.com/) for me.

    Best Regards,

    Kevin Shen.

    Thursday, October 9, 2014 1:53 AM
  • User-1033004070 posted

    Kevin, my project is located here.

    http://1drv.ms/1vOQn6y

    Thank you for your assistance with this.

    Thursday, October 9, 2014 8:01 AM
  • User1918509225 posted

    Hi sz56ms01,

    It seems that you  didn't post the database file in the project ,so I can't reproduce your issue.

    I still suggest you can set a breakpoint on your ajax calendar extender in updatepanel. see if it has any error message.

    and press f12 to check if it has any javascript error.

    Best Regards,

    Kevin Shen.

    Wednesday, October 15, 2014 3:06 AM
  • User555306248 posted

    In this scenario, I would like to suggest you remove the Update panels from the user controls, and this issue has been discussed in another thread. Please check the following link for more information:
     
    Strange Error - "Not A Registered Extender Control"
    http://forums.asp.net/p/1078866/2082230.aspx

    Can you place a call to base.RenderControl instead of base.Render? (Or override the Render method instead of RenderControl)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 19, 2014 11:40 PM