This is a migrated thread and some comments may be shown as answers.

Exception : The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

1 Answer 1332 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhammad Rashed
Top achievements
Rank 1
Muhammad Rashed asked on 04 Aug 2015, 09:55 AM

 I Added the grid in the Sharepoint web part  , I did not add any code behind  , I just added to the aspx the following : 

<telerik:RadGrid ID="RadGrid1" runat="server" >
 
</telerik:RadGrid>

The exception is:

 The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

 

  • [HttpException (0x80004005): The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.] System.Web.UI.ControlCollection.Add(Control child) +353 Telerik.Web.SkinRegistrar.RegisterCssReference(Page page, Type registerType, String url) +618 [HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.] Telerik.Web.SkinRegistrar.RegisterCssReference(Page page, Type registerType, String url) +729 Telerik.Web.SkinRegistrar.RegisterCssReferences(ISkinnableControl control) +683 Telerik.Web.UI.RadGrid.ControlPreRender() +56 System.Web.UI.Control.PreRenderRecursiveInternal() +155 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Control.PreRenderRecursiveInternal() +240 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4106

 

 

Any suggestions ?

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 06 Aug 2015, 06:31 AM
Hello Muhammad,

In order to fix the problem try moving the SPWebPartManager control in the MasterPage from the HEAD section into the BODY section of the html MasterPage.  

This is what you need to move into the BODY:

        <!--MS:<SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">-->
            <!--MS:<WebPartPages:SPWebPartManager runat="server">-->
            <!--ME:</WebPartPages:SPWebPartManager>-->
        <!--ME:</SharePoint:AjaxDelta>-->


Hope it helps.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Muhammad Rashed
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or