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

asp.net validators firing only after postback

12 Answers 503 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Abdul Rahman
Top achievements
Rank 1
Abdul Rahman asked on 16 Nov 2011, 07:52 AM
Hi,

Please help in the following issue .
The asp.net validator controls (like required field validator, compare validator etc) are firing after the postback (when the submit or rad grid insert button is pressed). This is happening in the case when the RadAjaxPanel is used.



Thanks & Regards,
AbdulRahman
TCS

12 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 18 Nov 2011, 11:20 AM
Hello Abdul,

What do you mean by saying that the validation fires after postback? Can you provide sample code for replicating the problem and a description of what happens exactly on your side?

Greetings,
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
Dian
Top achievements
Rank 1
answered on 01 Feb 2012, 08:21 AM
Hi,

Please help in the following issue .
The asp.net Required field validator controls  are firing after the postback. But then My combobox doesn't show me any fields in there? This happens when i select a item out of my "towncombobox" that populate my next combobox "Suburbs", so i can select out of Towns but if it do the postback i don't get any items in the Suburb Combobox? can you help me please?

Thanks
Dian Van Eeden
TGIS
0
Tsvetina
Telerik team
answered on 01 Feb 2012, 05:32 PM
Hi Dian,

I do not fully understand your scenario. What do you mean by that the validators are firing after postback? And also, can you confirm that your comboboxes work when there are no validators? If so, you can consider using ValidationGroups in your page to prevent validation of controls that should not be validated at this point.

If the problem persists, it would be helpful if you post your code, so that we can look for any problems with it.

Greetings,
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
Dian
Top achievements
Rank 1
answered on 02 Feb 2012, 08:50 AM
Hey just want to say thanks for your support .

I got it right after i posted the question.
I just set Causes Validation to False and it works .

Thanks alot
Dian
TGIS
0
Atul Kumar
Top achievements
Rank 1
answered on 24 Jul 2015, 11:27 AM

hi ,Tsvetina 

please help i am also facing same problem

 

0
Maria Ilieva
Telerik team
answered on 28 Jul 2015, 02:59 PM
Hi Atul,

Please provide some more details for the exact scenario you are implementing and for the issue you are currently facing. Thus we can revise your case locally and advise you further.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Dan
Top achievements
Rank 1
answered on 03 May 2016, 04:58 PM

Based on these Descriptions, I am encountering the same or related issue using: (Telerik.Web.UI. v. 2015.2.623.45)
In describing my situation let me just out by saying, that my particular set up/UI is a little complex and I believe is contributing to the behavior which I am about to describe:

Set Up: I have 4 Grids That are all using

EditMode="Batch"
<BatchEditingSettings EditType="Row" />

Each one of the grids is AJAX enabled and they are all affected/controlled by a (Customer) Selector.
Each one of the Grids has One or more validated fields for Update,  
ValidationSettings-CommandsToValidate="Insert,Update"
(Example for one of the columns:)
<ColumnValidationSettings EnableRequiredFieldValidation="true"><br>                                    <RequiredFieldValidator ForeColor="Red" ErrorMessage="<b>*</b>Required"  ValidationGroup="vgCustomers" Display="Dynamic"></RequiredFieldValidator><br>                                </ColumnValidationSettings>

Problem:
Validation works fine when Grids are first rendered (Unfiltered By Ajax selector), However once the Grid is (AJAX) filtered by the selector the validation does not work (looking at the rendered code confirms this the necessary mark up does not exist). Now in addition this only happens the first time around meaning if the edit is submitted (and errors) the validation reappears/works. The problem only exists when the grids reload from an AJAX post-pack initiated by the selector.

This is common to all 4 grid even though they are all set up a little differently. They also all use a _preRender method to do some specific grid customizations.

I can provide more code if necessary but do not want to overwhelm on initial Post.


0
Maria Ilieva
Telerik team
answered on 09 May 2016, 08:33 AM
Hi Dan,

Can you please share the entire RadGrid markup and related code behind as well as the Ajax settings you have on the page? Also please let me know which version of our controls you are using. Thus we will be able to revise the exact code locally and advise you further.


Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Dan
Top achievements
Rank 1
answered on 09 May 2016, 04:15 PM

Hi Maria,

Thanks for your response. I will appreciate any assistance provided. To that end, as per your request I can provide you with the One or all the Grid Mark up and ajax settings as well as the code behind. Is there an email address I can send this to rather than post it on this forum?

As indicated above I am using Telerik RadControls version 2015 2nd quarter for .net 4.5 (however my Target Framework is: 4.0),

<httpRuntime targetFramework="4.0"/>

Which I set because when I set it to 4.5  it caused JavaScript runtime errors in my .net validators, which, as I write this makes me think that is probably very much related to the issue I am encountering(?)

Thanks in advance, and please let me know how to proceed as far as submitting code, if still necessary?

 

 

 

0
Maria Ilieva
Telerik team
answered on 12 May 2016, 12:59 PM
Hi,

Try setting the TargetFramework to 4.5 and add the following setting int he applictaion web.config:

<appSettings>
  <add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" />
</appSettings>
 
and see how it goes


Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Dan
Top achievements
Rank 1
answered on 12 May 2016, 04:09 PM

Hi Maria,

Thanks for the suggestion. I have been down that road already, and the results are as Indicated above. The  ASP.net validators throw Javascript runtime errors. I actually answered a question in Stack dealing with that specific issue.
http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery/34078463#34078463
I think I may have to convert the Telerik Validaton wrappers to standard ASP.net Validation. I think that the issue is caused by a rendering conflict.

 

0
Maria Ilieva
Telerik team
answered on 17 May 2016, 12:00 PM
Hi,

Try converting the Validators and let us know what the result in this case is.

Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Ajax
Asked by
Abdul Rahman
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Dian
Top achievements
Rank 1
Atul Kumar
Top achievements
Rank 1
Maria Ilieva
Telerik team
Dan
Top achievements
Rank 1
Share this question
or