locked
composite control - error rendering control RRS feed

  • Question

  • User304384516 posted

    I have a composite control in an edititemtemplate. When I try to show the control in design mode, I get:

    Error Rendering Control - An unhandled exception has occurred. The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

    As far as I know, I am only modifying the control collection within CreateChildControls().

    Thursday, September 1, 2011 4:00 PM

Answers

  • User304384516 posted

    Fixed. I added this attribute to the CompositeControl-derived class.

    [Designer(typeof(System.Web.UI.Design.ControlDesigner))]

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 7, 2011 9:57 AM

All replies

  • User3866881 posted

    I am only modifying the control collection within CreateChildControls().

    Could you show us your codes in CreateChildControls?

    The control collection cannot be modified during DataBind,

    What did you do with DataBind()?

    Thx again

    Friday, September 2, 2011 8:44 PM
  • User304384516 posted

    Fixed. I added this attribute to the CompositeControl-derived class.

    [Designer(typeof(System.Web.UI.Design.ControlDesigner))]

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 7, 2011 9:57 AM