passing parameters to static user control

T

Tarscher

Hi all,

I designed a user control that I need to use in several pages. The
user control is added statically.

how can I pass parameters from the parent page to the user control?

Thanks in advance
Stijn
 
G

Guest

Howdy,

Expose public properties from the user control i.e.:

.... user control code - let's assume your control contains a label that
holds number customer phone number ...

public string CustomerPhone
{
get
{
return labPhone.Text;
}
set
{
labPhone.Text = value;
}
}
.... ..

Now, you can use this property programmatically (code behind):

customerData.CustomerPhone = "+44 123456789";

as well as declaratively (aspx code):

<uc1:YourCustomControlName runat="server" ID="customerData"
CustomerPhone="+44 123456789"/>
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top