How send parameters to user control

  • Thread starter Thread starter Yuri
  • Start date Start date
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!
 
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
 
Back
Top