Dymanic control recreate error with radgrid inside

3 posts, 0 answers
  1. Karen
    Karen avatar
    27 posts
    Member since:
    Jul 2008

    Posted 21 Jun 2009 Link to this post


    I am using radtabstrib and adding tabs and page views dynamically, page views itself has user controls inside, so I am recreating all this on each postback, however everything works perfect until I put radgrid inside the user control (it works ok with regular GridView) the error is the following.
    The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

    The exception throws as soon as I try to add user control with rad grid inside, into the page view
    private void RecreateTabsPageViews() 
            if (Session["TabPageViewsContents"] == nullreturn
            List<Control> PageViewsList = (List<Control>)Session["TabPageViewsContents"]; 
            int index = 0; 
            foreach (Control c in PageViewsList) 

    Please advice.
  2. Karen
    Karen avatar
    27 posts
    Member since:
    Jul 2008

    Posted 21 Jun 2009 Link to this post

    Update: Seems this is a problem with all rad controls, it is impossible to recreate user controls that have any of the rad controls inside
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sebastian
    Sebastian avatar
    9934 posts

    Posted 24 Jun 2009 Link to this post

    Hello Karen,

    I tried to reproduce the issue you depicted locally but my attempts were not successful. To progress in our investigation, is it possible for you to post the problematic page/user control along with their code-behind in this forum post using the 'Format Code Block' option at the top right corner of the forum editor? Thus I will examine your implementation in detail and will do my best to provide an accurate explanation/fix.

    You may also perform a quick test and see whether the same error appears when you remove the RadGrid instance from the user control, add a standard MS GridView in it and bind it to data.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top