I have many UserControls
and I wanna load them depended on query string
in one aspx
page.
I tired 2 following ways:
Add a
Placeholder
inaspx
page and inPage_Load/Page_Render
event:UserControl uc = (UserControl)LoadControl("/PATH/ProductGroups.ascx"); phMain.Controls.Add(uc);
Add a
MasterPage
, then add anaspx
and using of masterpage, then register theUserControl
on theaspx
But in both, I got following error:
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
BTW, I have used telerik TextEditor
in the loaded UserControl
.
How I can handle that?
I think the only way that I have, multiple aspx
per UserContorl
, without MasterPage
, this is sucks, as you know ! because I have to fix HTML/CSS/JS
in all pages, one by one and this is not pro !
NOTE: without using telerik TextEditor
, everything working fine, but I need this one, also this wat (loading UserControl
in PlaceHolder
) is not really good way.
I'm looking for something like DNN.