I have created an asp.net custom control and now want to pass some values to it from the page which will use the control.Is there any way i can add my own property to the control (like Text 开发者_开发百科property is present for a Label control) ?
It's a class. Add a public property to it.
Assuming ASP.NET 3.5+ just create properties
public string YourProperty {get; set;}
Would be declarative on the control
Adding a property to a custom control in asp.net is no different than adding a property on any class in C# (for instance).
public class Custom : Control
{
public string Text { get; set; }
}
just add it as public property, then it should be useable for your needs.
精彩评论