validation - Validators don't stop postback asp.net 4.5 -
here code page_validators undefined
<asp:updatepanel id="updatepanel1" updatemode="conditional" runat="server"> <contenttemplate> <fieldset> <div class="form form-horizontal"> <div class="form-group"> <label for="ddlparentcampus" class="col-lg-2 control-label">parent campus</label> <div class="col-lg-4"> <select runat="server" class="form-control" id="ddlparentcampus"></select> </div> </div> <div class="form-group"> <label for="txtcampusname" class="col-lg-2 control-label">campus name</label> <div class="col-lg-4"> <input type="text" runat="server" class="form-control" causevalidation="true" validationgroup="frmvalidation" id="txtcampusname" placeholder="campus name" /> <asp:requiredfieldvalidator id="requiredfieldvalidator1" controltovalidate="txtcampusname" validationgroup="frmvalidation" runat="server" setfocusonerror="true" forecolor="red" errormessage="campus name required!"></asp:requiredfieldvalidator> </div> </div> <div class="form-group"> <div class="col-lg-10 col-lg-offset-2"> <button id="btnsave" type="submit" runat="server" validationgroup="frmvalidation" class="btn btn-primary" onserverclick="btnsave_click"><i class='glyphicon glyphicon-ok'></i> save</button> <button id="btncancel" causesvalidation="false" type="submit" runat="server" class="btn btn-primary" onserverclick="btncancel_serverclick" onclick=""><i class='glyphicon glyphicon-ban-circle'></i> return</button> </div> </div> </div> </fieldset> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="btnsave" eventname="serverclick" /> </triggers> </asp:updatepanel>
sometimes struck in such cases seems no 1 in other million people faced.
asp.net 4.5 unobtrusive validation enabled default if add scriptmanager page client side validation won't work anymore if update jquery greater version 1.9+
<appsettings> <add key="validationsettings:unobtrusivevalidationmode" value="none" /> </appsettings>
this use "old style" non html5 validation , work ajax , jquery 1.9
this may else
Comments
Post a Comment