Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > RadAjaxManager and RequiredFieldValidator Problem
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Answered RadAjaxManager and RequiredFieldValidator Problem

Feed from this thread
  • prat avatar

    Posted on Apr 22, 2011 (permalink)


    Hello, Telerik Support

    I have a problem with RadAjaxManager and RequiredFieldValidator.
    I have a textbox with requiredfieldvalidator inside <asp:panel>

    On the first time of Page Load, I click the Submit Button without input any text in "txtFirstName".  the requiredfieldvalidator show the ErrorMessage as expect.

    after that i click the the reset button. the page has a partial postback in Panel1.
    when page already postback, now I click the submit  button without input any text in "txtFirstName" again. 
    the page has postback without client validate and after 2nd postback ErrorMessage is show.
    Why there is no validate on client side????

    My problem occurs when I run this code on web server. but in local server it's not happen.

    help me please, what am i do mistake?

  • Pavlina Pavlina admin's avatar

    Posted on Apr 22, 2011 (permalink)

    Hi Prat,

    RadAjax controls fully support server and client-side validation with the Standard Validators. However when the page uses ValidationSummary control, you need to wrap it in an ASP:Panel and add the panel to the UpdatedControls collection in the ajax settings when the page is ajaxified with RadAjaxManager. For more information about current RadAjax limitations go through the link below:
    http://www.telerik.com/help/aspnet-ajax/ajax-limitations.html

    Best wishes,
    Author nickname
    the Telerik team
    Pavlina
    the Telerik team

  • prat avatar

    Posted on Apr 22, 2011 (permalink)

    Thank you for your suggestion. but I uses only requiredfieldvalidator, no validation summary. The code works perfect on my local machine. the problem occurs only on web server. I don't know why??? when i remove radajaxmanager and uses asp:UpdatePanel
    the requiredfieldvalidator works as expect on web server. do you have any suggestion for my problem.

    Thank you.

  • prat avatar

    Posted on Apr 23, 2011 (permalink)

    I found that the problem come from MasterPage.
     
    when i test the code without using masterpage the requiredfieldvalidator works as expects.
    but the same code with using masterpage the requiredfieldvalidator is not validate page
    on client after partial postback.
     
    you can see live demo at
     
    http://aspspider.org/hanatas/ 

    Download Source Code here --> http://aspspider.org/hanatas/website.zip
      
     
    please help me, why the problem occurs when use masterpage.
    and the problem occurs only on web server***.

    Not use masterpage...
    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="TestWithOutMasterPage.aspx.cs" Inherits="TestWithOutMasterPage" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
    </head>
    <body>
        <script type="text/javascript">
            function RequestStart(sender, args) {
      
            }
      
            function ResponseEnd(sender, args) {
      
            }
        </script>
        <form id="form1" runat="server">
      
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
          <AjaxSettings>  
            <telerik:AjaxSetting AjaxControlID="btnSubmit">  
              <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />  
              </UpdatedControls>  
            </telerik:AjaxSetting>  
            <telerik:AjaxSetting AjaxControlID="btnReset">  
              <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />  
              </UpdatedControls>  
            </telerik:AjaxSetting>  
          </AjaxSettings>  
          <ClientEvents OnRequestStart="RequestStart" OnResponseEnd="ResponseEnd" />
        </telerik:RadAjaxManager>  
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista" />
            
        <asp:Panel ID="Panel1" runat="server"
          First Name: 
          <asp:TextBox ID="txtFirstName" runat="server"  MaxLength="100"></asp:TextBox>  
          <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" 
                 ControlToValidate="txtFirstName" 
                 ErrorMessage="First Name is required."
                 ValidationGroup="Add" >  
          </asp:RequiredFieldValidator>
          <br /><br />
          <asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="Add" OnClick="btnSubmit_Click" />  
          <asp:Button ID="btnReset" runat="server" Text="Reset" OnClick="btnReset_Click" />
        </asp:Panel>
        <br />
        After click Reset Button and click Submit Button again --> RequiredFieldValidator is still validate the page on client.
        </form>
    </body>
    </html>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
      
    public partial class TestWithOutMasterPage : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
      
        }
      
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //RadAjaxManager1.Alert("Hello");  
        }
      
        protected void btnReset_Click(object sender, EventArgs e)
        {
            txtFirstName.Text = "";
        }
    }

    Use MasterPage
    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TestWithMasterPage.aspx.cs" Inherits="TestWithMasterPage" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
      
    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
        <script type="text/javascript">
            function RequestStart(sender, args) {
      
            }
      
            function ResponseEnd(sender, args) {
      
            }
        </script>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
          <AjaxSettings>  
            <telerik:AjaxSetting AjaxControlID="btnSubmit">  
              <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />  
              </UpdatedControls>  
            </telerik:AjaxSetting>  
            <telerik:AjaxSetting AjaxControlID="btnReset">  
              <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />  
              </UpdatedControls>  
            </telerik:AjaxSetting>  
          </AjaxSettings>  
        </telerik:RadAjaxManager>  
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista" />
            
        <asp:Panel ID="Panel1" runat="server"
          First Name: 
          <asp:TextBox ID="txtFirstName" runat="server"  MaxLength="100"></asp:TextBox>  
          <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" 
                 ControlToValidate="txtFirstName" 
                 ErrorMessage="First Name is required."
                 ValidationGroup="Add" >  
          </asp:RequiredFieldValidator>
          <br /><br />
          <asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="Add" OnClick="btnSubmit_Click" />  
          <asp:Button ID="btnReset" runat="server" Text="Reset" OnClick="btnReset_Click" />
        </asp:Panel>
      
        <br />
        After click Reset Button and click Submit Button again --> RequiredFieldValidator is not validate the page on client.
      
    </asp:Content>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
      
    public partial class TestWithMasterPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
      
        }
      
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //RadAjaxManager1.Alert("Hello");  
        }
      
        protected void btnReset_Click(object sender, EventArgs e)
        {
            txtFirstName.Text = "";
        }
    }

    MasterPage
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
    <head runat="server">
        <title></title>
        <asp:ContentPlaceHolder id="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
        <form id="form1" runat="server">
          <div>
          Master Page
          <br />
          <hr />
          <br />
          <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
          </asp:ContentPlaceHolder>
          </div>
        </form>
    </body>
    </html>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
      
    public partial class MasterPage : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
      
        }
    }


    please help...

  • prat avatar

    Posted on Apr 23, 2011 (permalink)

    Oh... I solved my problem...

    because of  I bulid my project on .Net Framework 3.5  but the web server is .Net Framework 4.0
    I rebuild my project in .net framework 4.0 everything works perfect.

    Thank you.

  • Answer Pavlina Pavlina admin's avatar

    Posted on Apr 25, 2011 (permalink)

    Hi Prat,

    I am glad you were able to resolve the problem. In case you experience any further problems, do not hesitate to contact us again.

    Greetings,
    Pavlina
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > RadAjaxManager and RequiredFieldValidator Problem