How to pass some kind of data to a given Web User Control?

M

mehdi_mousavi

Hi,
I need to pass some variables to a given web user ctrl, say,
myctrl.ascx. e.g., I need to include the user control within a web form
as follows:

myctrl.ascx?myparam=myvalue&whatever=another_value

whilst somewhere else I would call the mentioned ctrl as

myctrl.ascx?myparam2=myvalue&whatever2=another_value

What's the way to go?

Any help would be highly appreciated,

Cheers,
Mehdi
 
J

john_teague

If you create public properties in your web control, you can set those
in the tag you put on the aspx page.

ascx code behind:
public int MyParam{
get{...}
set{...}
}

aspx page with user control
<cc1:MyControl MyParam="99"></cc1:MyControl>

public properties of a control are also available in the aspx code
behind as well.
 

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

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top