locked
Load ajax usercontrol problem RRS feed

  • Question

  • User-1509600987 posted

     Hi .i have a usercontrol use ajax 1.0 .and i use a class to load this usercontrol dynamically but i get a this error:

    <title>Extender controls may not be registered before PreRender.</title><style> </style>

    Extender controls may not be registered before PreRender.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
     

    If i load a normal usercontrol (dont use ajax component ,it run normly).Help me .thanks!

    here is mycode:

    WebUserControl.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="Includes_WebUserControl" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" TargetControlID="Button1" runat="server" >
    </cc1:ConfirmButtonExtender>
    <asp:Button ID="Button1" runat="server" Text="Button" />

    CustomClass.cs

    public class CustomClass:WebPart
    {
        
       
        public CustomContenType()
            {
                this.Title = "News";
                   
          
            }
        
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Control temp;
            temp = this.LoadControl("Includes/WebUserControl.ascx");
            //temp.ID = "uc1";
            temp.DataBind();
            Panel p = new Panel();
            p.Controls.Add(temp);
            this.Controls.Add(p);
         

        }

    }

    Tuesday, October 14, 2008 11:14 PM

Answers

  • User-1509600987 posted

     i had done.problem is my usercontrol.thanks all!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 20, 2008 10:06 PM

All replies