A control cannot modify its parents' control collections.

Discussion in 'ASP .Net' started by Alexandru Nedelcu, Jun 16, 2004.

  1. Hi!!!

    I'm trying to add a UserControl created using the
    Page.LoadCotnrol("test.ascx") method to a Page's Control collection and
    the exception I get is ( the complete stack trace):

    [HttpException (0x80004005): A control cannot modify its parents'
    control collections.]
    System.Web.UI.ControlCollection.Add(Control child)
    Akela.WebFramework.Design.TreeView.TreeNode.LoadUserControl() in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treenode.cs:451
    Akela.WebFramework.Design.TreeView.TreeNode.get_UserControl() in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treenode.cs:417
    Akela.WebFramework.Design.TreeView.TreeNode.TrackViewState() in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treenode.cs:1319

    Akela.WebFramework.Design.TreeView.BaseChildNode.System.Web.UI.IStateManager.TrackViewState()
    in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\basechildnode.cs:255

    Akela.WebFramework.Design.TreeView.BaseChildNodeCollection.System.Web.UI.IStateManager.TrackViewState()
    in
    D:\Projects\AkelaHR\LocalSourceSafe\AkelaHREnterprise\Akela.WebFramework\Design\TreeView\BaseChildNodeCollection.cs:472
    Akela.WebFramework.Design.TreeView.TreeNode.TrackViewState() in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treenode.cs:1318

    Akela.WebFramework.Design.TreeView.BaseChildNode.System.Web.UI.IStateManager.TrackViewState()
    in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\basechildnode.cs:255

    Akela.WebFramework.Design.TreeView.BaseChildNodeCollection.System.Web.UI.IStateManager.TrackViewState()
    in
    D:\Projects\AkelaHR\LocalSourceSafe\AkelaHREnterprise\Akela.WebFramework\Design\TreeView\BaseChildNodeCollection.cs:472

    Akela.WebFramework.Design.TreeView.BaseChildNodeCollection.SetViewStateDirty()
    in
    D:\Projects\AkelaHR\LocalSourceSafe\AkelaHREnterprise\Akela.WebFramework\Design\TreeView\BaseChildNodeCollection.cs:206

    Akela.WebFramework.Design.TreeView.TreeView.CopyXmlNodesIntoTree(TreeNodeCollection
    col, Object dest) in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treeview.cs:1462
    Akela.WebFramework.Design.TreeView.TreeView.ReadTreeNodeXmlSrc() in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treeview.cs:1437
    Akela.WebFramework.Design.TreeView.TreeView.OnInit(EventArgs e) in
    d:\projects\akelahr\localsourcesafe\akelahrenterprise\akela.webframework\design\treeview\treeview.cs:851
    System.Web.UI.Control.InitRecursive(Control namingContainer)
    System.Web.UI.Control.InitRecursive(Control namingContainer)
    System.Web.UI.Control.InitRecursive(Control namingContainer)
    System.Web.UI.Page.ProcessRequestMain()


    Can anyone give a hint?

    Thanks in advance,
    Alex
     
    Alexandru Nedelcu, Jun 16, 2004
    #1
    1. Advertising

  2. "Alexandru Nedelcu" <> wrote in message
    news:...
    > Hi!!!
    >
    > I'm trying to add a UserControl created using the
    > Page.LoadCotnrol("test.ascx") method to a Page's Control collection and
    > the exception I get is ( the complete stack trace):
    >
    > [HttpException (0x80004005): A control cannot modify its parents'
    > control collections.]

    ....

    > Can anyone give a hint?


    Yes. "Don't _do_ that!"

    :)

    Add the user control to the Controls collection of the control whose event
    you're handling.
    --
    John Saunders
    johnwsaundersiii at hotmail
     
    John Saunders, Jun 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug Poland
    Replies:
    9
    Views:
    752
    VisionSet
    Sep 27, 2003
  2. mutex
    Replies:
    0
    Views:
    227
    mutex
    Jul 27, 2003
  3. thunk
    Replies:
    1
    Views:
    347
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    522
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    655
    thunk
    Apr 3, 2010
Loading...

Share This Page