ASP.NET: validating custom controls

Sep 8, 2007

A short hint for ASP.NET developers... If you want your custom control to be validated by ASP.NET validators, simply add a "ValidationPropertyAttribute" attribute to your class definition. Like this:


[ValidationPropertyAttribute(”Message”)]
public class myCustomControl
{
//"message" property, which we want to be validated
public string Message
{
get { return “My Message”; }
}
}

2 comments:

Anonymous said...

This information is incomplete. More work needs to be done to accomplish validation of custom controls.

Anonymous said...

Thanks a lot! That is the information i was looking for. It works!

Post a Comment