By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,537 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,537 IT Pros & Developers. It's quick & easy.

add parameter into dynamic user control

P: n/a
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
Dec 1 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
After loading the control:

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

"Stanley Cheung" wrote:
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

Dec 1 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.