How send parameters to user control

Y

Yuri

Hello, friends!
I created a simple user control which reuse common UI
functionality.
I have successfully gotten it working. The only problem I
passing parameters to the User control from design time.
Maybe it's not possible it all.
The code in design time looks like this:
<%@ Register TagPrefix="uc1" TagName="GaugeForms"
Src="GaugeForms.ascx" %>

<td width="35%">
<uc1:GaugeForms id="GaugeForms1"
runat="server"></uc1:GaugeForms>
</td>

I need send some string to the code behind.
Thank you for help!
 
D

Daniel Melo

You can define properties for your Web User Control.

In the Code-Behind define a property, for example :

private string _property1;

public string property1 {
get {
return _property1;
}
set {
_property1 = value;
}

}

Now, you can set values for this property in the HTML. like :

<uc1:GaugeForms id="GaugeForms1" runat="server" property1="a
value"></uc1:GaugeForms>

Easy like this.

Regards,

Daniel
 

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

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,104
Latest member
LesliVqm09
Top