add parameter into dynamic user control

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
 
G

Guest

After loading the control:

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top