locked
maintaining dynamically created controls in custom server controls RRS feed

  • Question

  • User-1221966532 posted

    Hi,

    I created a Toolbar like server control which can contain multiple ToolbarItems. When the ToolbarItems (short items) are added dynamically in the OnInit or PageLoad event of the page the items are hooked up properly (items maintained between postbacks, server click events work properly).

    There is however a need to be able to add items dynamically outside of the above life cycle events. Say a button is clicked and in its Button_Click handler more items are added to the Toolbar. These "late" items are not showing up, which I do understand why as they are added to the control too late and aren't wired up properly, but is there a workaround for this?

    Monday, July 9, 2012 9:05 AM

Answers

  • User3866881 posted

    Please make sure that you've called something like Controls.Add(some new controls) in the event of page-LoadComplete in order to add more controls there.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 10, 2012 9:51 PM

All replies

  • User-661350001 posted

    not very clear on you question 

    all the added controls are rendred and sent to client at one shot

    Monday, July 9, 2012 10:59 AM
  • User3866881 posted

    Please make sure that you've called something like Controls.Add(some new controls) in the event of page-LoadComplete in order to add more controls there.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 10, 2012 9:51 PM