Atlanta .NET Regular Guys

Atlanta's .NET Regular Guys work to bring Atlanta's .NET development community closer together.

Contact us by sending mail to either Brendon or Matt

Welcome to Atlanta .NET Regular Guys Sign in | Join | Help
in Search

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

Last post 11-30-2006, 10:15 AM by itai. 0 replies.
Sort Posts: Previous Next
  •  11-30-2006, 10:15 AM 2319

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

    hi!

    I'm trying to create an ESRI web map control  dynamically on a WebPart using C# and VS 2005.

    When using it on a regular aspx file it works good - I create it, initialize it, and then add it to the page

    with the - Form.Controls.Add(MyWebMapControl);

    I added it with the "Form.Controls.Add()" and Not with just "Controls.Add()" because that with "Controls.Add()" I get an error that tells me that the webMapControl should be placed inside a form tag.

    anyway I took the code ,copied it and paste it to my webpart, everything went good exept that there isn't any "Form" Data member when inheriting from webpart.

    So I tried Page.Form.Controls.Add() but I got this Error :

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

    I tried to add the webMapControl to the webPart with the "Controls.Add()" but it gave me an unspecified error and I know that it's becuse that With Only "Controls.Add" it puts the WebMapControl rendered html outside a form tag.

    How can I access the Form property of the WebPart without getting an Error ,or any other way to add my control to the page..

     

    thank's

    Itai

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems