SharePoint and Ajax websites

Please, I'm new to websites and I need help!

I have a custom web part that I created. I added MS Ajax to it using UpdatePanel which works great. I add all my controls to the CreateChildControls method. As soon as I add the UpdateProgress control, my page breaks with the following error:

Script Controls may not register before PreRender

I am not using the OnPreRender event as other posts suggest. Please if anyone can give me some advice, it would be greatly appreciated.

thank

+1


source to share


2 answers


I faced similar issue earlier, try calling EnsureChildControls method inside init method override. It should be called automatically by the system, but sharepoint likes to forget about it from time to time.

Like this:



    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        EnsureChildControls();
    }

      

+2


source


You may have forgotten to name the base method of the overridden event, which is not necessarily the OnPreRender event.

Make sure the OnInit or OnLoad events call their base.On [...] method, for example:



protected override void OnLoad(EventArgs eventArgs)
{
    base.OnLoad(eventArgs);

    // your code...
}

      

+1


source







All Articles