hi,
how to validate validations whether textbox is empty or not. using linq to sql.
Regards,
Venkat
how to validate validations whether textbox is empty or not. using linq to sql. in mvc
442818-Nov-2011
Updated on 22-Nov-2011
Home / DeveloperSection / Forums / how to validate validations whether textbox is empty or not. using linq to sql. in mvc
Chris Anderson
22-Nov-2011you can put validation using linq to sql query something like below:
if (query.Count() > 0) throw new Exception("Id already exists in the database");
venkat gosetty
22-Nov-2011Chris Anderson
18-Nov-2011if 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?