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

RadAjaxManager.ajaxRequest cause duplicate error message in ValidationSummary

4 Answers 86 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
dexter
Top achievements
Rank 1
dexter asked on 20 Mar 2012, 12:17 PM
Hi,

Below describes my page:
A ValidationSummary control at the top of my page.
A RadComboBox with a RadTreeView as the ItemTemplate.
A password textbox with a RequiredFieldValidator to validate this textbox(validation group = save )
An input type='file' control
A RadToolBar with submit button with validation group = save

Because the RadTreeView will cause a full postback(which will clear the file control), i'm setting the OnClientNodeClicking event to raise the ajax Request.
This works fine(file control will not be cleared) but there is a problem with this. Whenever i select a node in the TreeView and the password textbox is empty, the error messages is appended to the validation summary control rather than overweriting it.

This reproduces the problem:

1) Leave the password textbox empty
2) Select the tree view node(3 times)
3) While the password textbox is still empty, click on the submit
4) You will see the error messages showing three times. If step 2 is repeated 10 times, then the message will have 10 duplicates.

Why is this happening?

I hope someone can help.

Regards,
Dexter

4 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 23 Mar 2012, 10:38 AM
Hello Dexter,

Can you confirm that you have a setting where the RadAjaxManager on the page updates the ValidationSummary? If not, add it and see if it helps. In case the issue persists, please share code that we can use to reproduce the erroneous behavior.

Kind regards,
Tsvetina
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
dexter
Top achievements
Rank 1
answered on 23 Mar 2012, 10:52 AM
Hi Tsvetina,


I'm not sure if this is the right way to solve this, but this is what i did. I just want to share to those thats having the same problem.
I use custom validator instead of RequiredFieldValidator to check the problem and use CliendValidateFunction to explicitly call a javascript function. In that function, i will set the args.IsValid property.

The most important thing however, is this part:
Sys.Application.add_load(Page_Load);

function PageLoad(){    

if

 

 

(Page_IsValid === false)//I can only call it here. Anywhere else wouldn't work because i'm

 

{                          //trying to overwrite the duplicate error message
    $('#vs').text("error message");

 

}//vs is the validation summary's ID
 }
}

Regards,
Dexter

0
Spiros
Top achievements
Rank 1
answered on 15 Jul 2014, 07:30 AM
Hi Guys..
We have a similar problem using telerik RadAjaxManagerProxy and Validation Summary.
The RadAjaxManagerProxy updates the validation Summary but the errors remains duplicated ..
Any Idea ?
Thanks in advance
Spiros
0
Shinu
Top achievements
Rank 1
answered on 15 Jul 2014, 11:02 AM
Hi Spiros,

Please have a look into the sample code snippet which works fine at my end.

ASPX:
<telerik:RadTextBox ID="rtxtPassword" runat="server" TextMode="Password">
</telerik:RadTextBox>
<asp:RequiredFieldValidator ID="valPassword" runat="server" ErrorMessage="Password is mandatory!"
    ControlToValidate="rtxtPassword" Display="None" ValidationGroup="MyInquiryForm">*</asp:RequiredFieldValidator>
<asp:ValidationSummary ID="ContactValidationSummary" runat="server" ShowSummary="true"
    ShowMessageBox="false" HeaderText="Please notice that:" ValidationGroup="MyInquiryForm"
    DisplayMode="BulletList" />
<telerik:RadTreeView ID="rtreeviewDemo" runat="server" MultipleSelect="true">
    <Nodes>
        <telerik:RadTreeNode Text="Node1">
        </telerik:RadTreeNode>
        <telerik:RadTreeNode Text="Node2">
        </telerik:RadTreeNode>
        <telerik:RadTreeNode Text="Node3">
        </telerik:RadTreeNode>
    </Nodes>
</telerik:RadTreeView>
<telerik:RadButton ID="rbtnSubmit" runat="server" Text="Submit" CausesValidation="true"
    ValidationGroup="MyInquiryForm">
</telerik:RadButton>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rtreeviewDemo">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rtreeviewDemo" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>

Please provide a sample code if it doesn't help.
Thanks,
Shinu.
Tags
Ajax
Asked by
dexter
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
dexter
Top achievements
Rank 1
Spiros
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or