none
How to solve this "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases"

    Frage

  • I have created user control in which i am creating dynamically raddocks and adding to the zone. as follows

    RadDockLayout

     

    radDockLayout = (RadDockLayout)this.Parent.FindControl("rdLayout");

     

    Label label = new Label();

     

    DockCloseCommand closeCommand = new DockCloseCommand();

    dockTitle = wpTitle.Replace(

    " ", "");

    label.Text =

    "This is " + wpTitle + "Webpart";

     

    RadDock dock = new RadDock();

    dock.ID =

    "rd" + dockTitle;

    dock.Title = wpTitle;

    dock.Height =

    Unit.Pixel(70);

    dock.DockMode =

    DockMode.Docked;

    dock.ContentContainer.Controls.Add(label);

    dock.Style.Add(

    "position", "relative");

    dock.AutoPostBack =

    true;

    dock.DockPositionChanged +=

    new DockPositionChangedEventHandler(dock_DockPositionChanged);

    dock.DockHandle =

    DockHandle.TitleBar;//.Unload += new EventHandler(dock_Unload);

    dock.CommandsAutoPostBack =

    true;

    dock.Commands.Add(closeCommand);

    dock.Command +=

    new DockCommandEventHandler(dock_Command);

    radDockLayout.Controls.Add(dock);

    dock.DockZoneID =

    "rdz" + zoneID;

    on the aspx page where i access this user control, put the raddocklayout inthis way:

    <

     

    table>

     

    <tr><td><asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>

     

    <telerik:RadDockLayout ID="rdLayout" runat="server" >

     

    <UC:ucWPPerson id="ucPersonalization" runat="server" />

     

    </telerik:RadDockLayout>

     

    </td></tr>

     

    </table>

    when we run the code the following error is coming on the line of code 'radDockLayout.Controls.Add(dock);'

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

    Please suggest me.

    Thanks

    • Verschoben SamAgain Freitag, 1. Oktober 2010 02:25 better fit (From:Building Development and Diagnostic Tools for .Net)
    • Verschoben Jing0 Montag, 4. Oktober 2010 06:19 (From:Windows Forms Data Controls and Databinding)
    Mittwoch, 29. September 2010 15:41

Alle Antworten

  • Hi,

     

    This forum is for discussing questions about windows forms application development. This question is beyond of the scope here.

     

    http://forums.asp.net is Microsoft official forums for discussing asp.net questions. You could get quicker and better responses there. There are more ASP.NET experts live in those forums.

     

    Best regards,

    Ling Wang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Montag, 4. Oktober 2010 06:18
  • Hello  Harsh,

    This forum is dedicated to Microsoft Visual Studio Windows Forms technology, your question is off topic here. Looks like you are working with a third-party class (RadDockLayout class in Telerik.Web.UI assembly).  You might consider asking in a forum for that product.

    Sincerely,
    Helen Zhou


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Montag, 4. Oktober 2010 08:05