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

Loading controls dynamically + passing parameters

P: n/a

I can use following syntax to add user controls directly to my pages :
<XYZ:myControl parameter1="value1" parameter2="value2" runat="server" />
The control "myControl" is executed using the supplied parameters parameter1
and parameter2

Now my question :
I've found two ways to add controls dynamically to my page :

method 1
page.loadControl("<.ascx file>")

method 2
activator.createInstance(type.getType("<class name>", true))

The problem is : how can I pass the parameters parameter1 and parameter2 to
the control ?
Thanks for any advice
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a


I'm not familiar with the first technique you mention.

But for loading dynamically the control should have properties to hold
the values for parameter1 and parameter2.

Then in the code for the page have a variable for the user control.

dim lControl as MyControl
lControl = LoadControl("MyControl.ascx")
lControl.parm1 = someValue

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.