c# - How reliable is the ASP.NET Validator? -
i decided utilize asp.net validator validate dozens of inputs of webform. works fine on client side. mean, i'm totally ok validating inputs without "posting page back" etc.
but when seek utilize validator on code behind, gives me page.isvalid
attribute, , confused reliability. here questions couldn't reply myself:
here code wrote validate inputs on server side:
foreach (ivalidator ivalidator in page.validators) { if (!ivalidator.isvalid) { homecoming false; } }
but, independent .aspx , .js? can rely on on server side?
you should validate on serverside, done automatically calling page.validate
.
from msdn:
this method invoked when user clicks asp.net server command has causesvalidation property set true, default. these include button, imagebutton, , linkbutton web server controls, htmlinputbutton, htmlinputimage, , htmlbutton html server controls, , controls can automatically post server such textbox, checkbox, listcontrol, , bulletedlist controls.
if want forcefulness validation of different validationgroup
can phone call manually:
page.validate("myvalidationgroup"); if(page.isvalid) { // ... }
note should check page.isvalid
after have called page.validate
method, or set causesvalidation
property true in onserverclick
event handler asp.net server command initiated form processing.
c# javascript .net validation code-behind
No comments:
Post a Comment