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

Duplicate ASP.NET validation messages

2 Answers 74 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
David Rhodes
Top achievements
Rank 1
David Rhodes asked on 13 Aug 2013, 08:31 AM
Hi,

I have a form which contains a few TextBoxes with RequiredFieldValidators and serveral UserControls each containing RadGrid's, inside each UserControl I am using the following to ajaxify

<telerik:RadAjaxManagerProxy runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Grid">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Grid" LoadingPanelID="LoadingPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadAjaxLoadingPanel ID="LoadingPanel" runat="server" />

The problem is, everytime I do a postback in any of the RadGrid's, the RequiredFieldValidator messages are duplicated.

I've read elsewhere that I need to add the ValidationSummary as an UpdatedControl to what is causing the problem but this does not work in this case as the ValidationSummary is in the page, the Grid is in a UserControl

Any ideas?

2 Answers, 1 is accepted

Sort by
0
David Rhodes
Top achievements
Rank 1
answered on 13 Aug 2013, 08:49 AM
I've also tried passing a reference to the ValidationSummary into the UserControl so I can add it like this

protected override void OnPreRender(EventArgs e)
{
    RadAjaxManager ajax = RadAjaxManager.GetCurrent(Page);
    ajax.AjaxSettings.AddAjaxSetting(Grid, Grid, LoadingPanel);
    ajax.AjaxSettings.AddAjaxSetting(Grid, this.SubscriptionValidationSummary, LoadingPanel);
     
    base.OnPreRender(e);
}

This still causes duplicate error messages

Also, I have other Ajaxified controls on the Page which don't cause this issue, eg a DatePicker which updates another DatePicker, only the Grids seem to cause this issue
0
Angel Petrov
Telerik team
answered on 16 Aug 2013, 06:13 AM
Hi David,

The PreRender event is fired too late for creating the AJAX setting programmatically. Please try moving the logic in the PageLoad event like demonstrated in this help article. If the problem still persists please share with us the markup and code-behind so we could get a better understanding of the scenario.

Regards,
Angel Petrov
Telerik
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 the blog feed now.
Tags
Ajax
Asked by
David Rhodes
Top achievements
Rank 1
Answers by
David Rhodes
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or