I tried to make ValidationAttribute which would check the database whether such an object.
And it even works only if you do not include <% Html.EnableClientValidation ();%>
Can Someone tells how to get to work through Ajax
public class UsernameBaseCheckAttribute : ValidationAttribute
{
SimplebdLinqDataContext db = new SimplebdLinqDataContext(); //DataContext(Linq)
public override bool IsValid(object value)
{
if (!db.Users.Any(u => u.UserName == (string)value))
{
return true;
}
else
{
return false;
}
}
}