add parameter into dynamic user control

  • Thread starter Thread starter Stanley Cheung
  • Start date Start date
S

Stanley Cheung

Dear all,

how can I pass a parameter to dynamic user control?
As I know we can pass parameter into traditional user control.
e.g: add pageid into user control and write a property from user control
<uc1:uccc id="uccc1" runat="server" pageid="1"></uc1:uccc>

I can create dynamic user control but don't know how to pass parameter into
user control.

****************** my original code ***********************
Control myControl = (Control) LoadControl("control/template1.ascx");
PlaceHolderTemplate.Controls.Clear();
PlaceHolderTemplate.Controls.Add( myControl );
**********************************************************

Thanks in advanced.
steambun
 
After loading the control:

((<user control class>)myControl).<property name> = <value>;
 
Back
Top