ASP.Net 4.5 Validation Controls not working with AJAX ToolkitScriptManager1 RRS feed

  • Question

  • User965150598 posted


    I have a project in which I am using the 'unobtrusive.....' validation so it includes the references to all the JScript libraries in the global.asax. I also have pages that utilize the ASP.Net Validation controls and summary. For some reason I cannot get the validation controls to work correctly. Below is a summary of my challengers:<o:p></o:p>

    1. The first time the page loads, on the client side, when tabbing out of a field that has a required field validator attached to it, the "text" assigned to the validator does not display<o:p></o:p>

    2. If I click the submit button, the "text" associated with the required field validator now displays but I don't get the pop-up window from my validation summary.<o:p></o:p>

    3. If I then enter text in the text boxes that have required field validators assigned, the "text" assigned will not disappear until I click on the submit button.<o:p></o:p>

    My ASPX page code is below and I have nothing in my code behind.  I have also tried with the script manager inside and outside the update panel.  Any assistance would be greatly appreciated.  

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test1.aspx.vb" Inherits="test1" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <form id="form1" runat="server">
            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ></asp:ToolkitScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator" ValidationGroup="contentgroup">*</asp:RequiredFieldValidator>
                            <br />
                            <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> 
                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="RequiredFieldValidator"  ValidationGroup="contentgroup">*</asp:RequiredFieldValidator>
                            <br />
                            <asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="contentgroup" />
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="contentgroup" ShowMessageBox="True" ShowSummary="False" />            

    Friday, January 18, 2013 11:49 AM

All replies

  • User555306248 posted

    Watch this video it may helphttp://www.asp.net/learn/ajax-videos/video-150.aspx  Also check out the validator callout sample at http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ValidatorCallout/ValidatorCallout.aspx

    Sunday, January 20, 2013 11:00 PM
  • User965150598 posted

    I am not using and cannot use the Validation Callout but that is not the source of the problem regardless.  I have verified the source of the problem is the UnobtrusiveValidationMode.  I was attempting to use UnobtrusiveValidationMode with the jquery 1.9.0 libraries and none of my client side validation was working.  When I added the line of code below to disable the UnobtrusiveValidationMode everything went back to working normal.

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

    If anyone knows how to get the client side validation to work with the UnobtrusiveValidationMode and jquery 1.9.0 please let me know.  I believe I followed all the needed steps for implement the UnobtrusiveValidationMode but it did not work with jquery 1.9.0.



    Tuesday, January 29, 2013 9:47 PM
  • User-1388963663 posted

    Thanks GCeaser you saved my life after 5 hours of hell trying to understand why client side validation won't work even on the most basic examples.

    What I don't understand is that ASP.NET 4.5 is relatively new, I think now many people switched to it, validation (and client side validation) even with ajax enable is still a common pratice even on the most simple dynamic sites, jQuery 1.9+ is the actual standard so... how is it possible that in the whole world only me and you struck into this issue... I was really going mad! And also, now that I got to the core of the issue, even if I do targeted searches on the subject, this is the only topic where someone seems to have had the issue. 

    This is quite mindblowing for me... also that the Unobtrusive option is on by default doesn't seem a wise choice to me both for the HTML5 and mostly for such problems. At least it should be pointed out more obviously together with the new feature how to disable it, not just in the last line of a MS reference page... I know I'm a bit polemic here but after 5 hours of this $%!#!"" you can understand me..

    Tuesday, May 14, 2013 5:02 PM
  • User-1438587911 posted

    Thank you for your post! I was having same issues...I was suspecting it was related to the 'new and great' features of 4.5. Nobody else is really getting  into the 'new and great' features yet, so there is no help yet...just mere frustration. Thanks for your answer!

    Monday, June 17, 2013 1:05 PM
  • User-1816821705 posted

    thank you.. it worked for me also.. i spend 5 hours in this issue.. once again thank you.. :) Smile 

    Saturday, February 7, 2015 5:01 AM
  • User-1816821705 posted

    thank you... this worked

    Tuesday, February 10, 2015 8:14 AM
  • User194174656 posted

    It works...... Thank you.

    Tuesday, March 31, 2015 3:50 PM