validation summary with radajaxmanager

3 posts, 0 answers
  1. Big
    Big avatar
    3 posts
    Member since:
    Sep 2011

    Posted 23 Sep 2011 Link to this post

    I have the following code that has two checkboxes. Each displays a panel when it is clicked. The first checkbox is attached to a validator.
    if the text is left empty and both checkboxes are clicked, and the submit button is clicked, the validation summary dispalys the error message twice. Why does it do that??
    here is my markup. I have simplified it to the very bare minimum: 

    <form id="Form1" method="post" runat="server" style="margin-left: 0px; margin-top: 0px">  

    <asp:ScriptManager ID="scriptManager1" runat="server"></asp:ScriptManager>  

    <telerik:RadAjaxManager ID="ajaxManager1" runat="server"> 

    <telerik:AjaxSetting AjaxControlID="chkMain">
    <telerik:AjaxUpdatedControl ControlID="panelMain" />



    <telerik:AjaxSetting AjaxControlID="chkSub">
    <telerik:AjaxUpdatedControl ControlID="panelSub" />
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
    <asp:CheckBox ID="chkMain" runat="server" Checked="false" Text="main" AutoPostBack="true" OnCheckedChanged="chkMain_CheckedChanged" />
    <asp:Panel ID="panelMain" runat="server" Visible="false">
    <asp:TextBox ID="MainText" runat="server" />
    <asp:RequiredFieldValidator ID="rv1" runat="server" ControlToValidate="MainText" ErrorMessage="required" />
    <asp:CheckBox ID="chkSub" runat="server" AutoPostBack="true" Checked="false" Text="sub" />
    <asp:Panel ID="panelSub" runat="server" Visible="false">
    <asp:Button ID="btnSubmit" CausesValidation="true" runat="server" Text="Submit"></asp:Button>

    and my codebehind is very simple too:

    protected void Page_Load(object sender, EventArgs e)  



    protected void chkMain_CheckedChanged(object sender, EventArgs e)


    panelMain.Visible = chkMain.Checked;


  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 28 Sep 2011 Link to this post

    Hi Big,

    The source of the issue is the fact that the RequiredFieldValidator is not visible when the page is initially loaded. And after ajax its scripts are not properly evaluated. To overcome that issue, you should either move the validator outside the panel and alter its Enabled property in respect to Visible property of the panel. Or use ASP:UpdatePanels instead of RadAjax. Or disable the validator client scripts by setting its EnableClientScripts property to false.

    Best wishes,
    Iana Tsolova
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. Tim
    Tim avatar
    87 posts
    Member since:
    Aug 2008

    Posted 29 May 2013 Link to this post

    I have the same issue.  Is there any way to use a standard UpdatePanel with the RadAjaxLoadingPanel?  Or have a loading panel for the standard UpdatePanel which mimics the style used for the current Telerik Theme?
Back to Top