How can I use this convention in an asp.net WEBFORM Business object class?
Example In MVC
using System.ComponenModel.DataAnnotation;
public class Customer
{
[Required]
[StringLength(5,20)]
public string FirstName { get; set;}
[Required]
[StringLength(5,20)]
public string LastName { get; set;}
}
I want to use this data annotation in my asp.net webform businessobject class for client validation and server validation.
Unfortunately WebForms doesn't have native support of Data Annotations like MVC.
But you can use custom decisions:
system componentmodel dataannotations for asp.net webforms
Building an ASP.NET Validator Using Data Annotations
ASP.NET: WebForms Validation with Data Annotations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With