UserControls

G

Guest

Hello All,

I've declared my usercontrol in the normal way (page directive) and to load
it I'm doing: <webapp:menu runat="server" />. However, is there a way I can
pass a parameter into it as this menu will be used on a number of pages and
on each page it needs to show the same info, but with a different css applied
so i need to know what page i'm on.

Any other ideas would be appreciated also,

Thanks,

Jon
 
F

Francois

You can create a property in you user control in the following manner:

private string param;
public string Param
{
get
{
return this.param;
}
set
{
this.param = value;
}
}

Then, when you declare your user control in the ASPX code, you can assign a
value for that parameter.

<webapp:menu runat="server" Param="my_parameter_value" />

Hope this help.
Francois
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top