1

here is my code my page_validators is always 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 is 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>&nbsp;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>&nbsp;Return</button>
                                </div>
                            </div>
                        </div>
                    </fieldset>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="ServerClick" />
                </Triggers>
            </asp:UpdatePanel>
dnxit
  • 7,118
  • 2
  • 30
  • 34

1 Answers1

0

Sometimes you get struck in such cases where it seems no one in other million people faced.

ASP.NET 4.5 unobtrusive validation enabled by default if you just add a scriptmanager to the page client side validation won't work anymore if you update Jquery to greater version than 1.9+

<appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>

This will use "old style" non HTML5 validation and WILL work with ajax and JQuery 1.9

this may help someone else

dnxit
  • 7,118
  • 2
  • 30
  • 34
  • 1
    Microsoft fixed their unobtrusive validation library to be compatible with jQuery 1.9+ about two weeks after 1.9 was released. Update the package through the Package Manager Console as described here: http://stackoverflow.com/a/15539422/680485 – ThatMatthew Feb 25 '16 at 16:02