RequiredFieldValidator - So if Javascript is disabled the whole .NET controls are avoided?
I'm using .NET recently, and I check some fields.
I know that the开发者_如何学编程 check is client-side (javascript) and on server-side with :
Page.Validate();
if (!Page.IsValid)
{
}
But if the javascript is disabled all of them are not checked (in fact the javascript return false when I try to do the request to the server.
So, is this a limitation of .NET or there are other way to do these check without JS?
You are right, using Page.IsValid
will only return correct value if javascript is enabled / supported in the browser. So, good web programming practice is to run same validations again at server side regardless of client side validation consideration. Because client side javascript can be altered easily in browser to bypass that the validations.
That will ensure you are accepting correct values.
精彩评论