hi venkat, if you want validate your textbox, simply use: namespace: using System.ComponentModel.DataAnnotations; and above the property add following: [StringLength(50),Required] publicstring Name { get; set; } why you use linq to sql for validation?
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
you can put validation using linq to sql query something like below:
if (query.Count() > 0) throw new Exception("Id already exists in the database");
if you want validate your textbox, simply use:
namespace:
using System.ComponentModel.DataAnnotations;
and above the property add following:
[StringLength(50),Required]
public string Name { get; set; }
why you use linq to sql for validation?