UserControl with parameters

  • Thread starter Thread starter Kiyomi
  • Start date Start date
K

Kiyomi

I have created a UserControl which takes two input parameters to run.

I now would like to use this UserControl in aspx page in which the user can
supply two parameters.

How can I pass these parameters from aspx to the UserControl ?

Thank you very much for your help.

Kiyomi
 
if you dragged and dropped the control onto the form you might find that
there is no definition for the control on the page. If you put that in you
will have access to methods and properties on the control.

such as....

protected myproject.userControls UserAccess1;
 
Hi Kiyomi,
To supply input values to the user controls, you should define public
properties in the user control.

For ex. you have give the property in the usercontrol is like "ProductName".
In the aspx page pass value to "ProductName" property as below.

<tagPrefix:tagname .... ProductName="Press" >

Hope this helps you.
Thanks,
Ragu.
 
Thank you, Josh, for your prompt reply.

Since I am using vb so I have placed the following code in my aspx page :

Protected WithEvents UserAccess1 As myproject.userControls

Although userControls.ascx (and Cass userControls) exsits, .NET does not
want to recognize it and tells me "Type myproject.userControls is not
defined."

Do I have to import something ?
 
Protected WithEvents UserAccess1 As myproject.userControls
Although userControls.ascx (and Cass userControls) exsits, .NET does not
want to recognize it and tells me "Type myproject.userControls is not
defined."

check that your "myproject.userControls" is the namespace used in the code
beind file of the usercontrol, they should match
 

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

Back
Top