This is a migrated thread and some comments may be shown as answers.

validation summary with radajaxmanager

2 Answers 100 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Big
Top achievements
Rank 1
Big asked on 23 Sep 2011, 10:18 PM
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"> 

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

</UpdatedControls>

 </telerik:AjaxSetting>

<telerik:AjaxSetting AjaxControlID="chkSub">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="panelSub" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<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:Panel>
<asp:CheckBox ID="chkSub" runat="server" AutoPostBack="true" Checked="false" Text="sub" />
<asp:Panel ID="panelSub" runat="server" Visible="false">
Description
</asp:Panel>
<asp:Button ID="btnSubmit" CausesValidation="true" runat="server" Text="Submit"></asp:Button>
</form>

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 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 28 Sep 2011, 09:29 AM
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
0
Tim
Top achievements
Rank 1
answered on 29 May 2013, 03:28 PM
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?
Tags
Ajax
Asked by
Big
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Tim
Top achievements
Rank 1
Share this question
or