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

Doing Ajax without Validation

3 Answers 60 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Tahir Ahmed
Top achievements
Rank 1
Tahir Ahmed asked on 01 Oct 2011, 09:19 AM
Hello,

I have a page in which I have placed couple of ASP.NET standard validators which work on text boxes and ask user to enter a value if its empty such as "enter name", there is also a custom validator which checks the RadUpload control for valid extentions, I have used this JavaScript function to cause extention validation.

 

function ValidateUpDetails(source, arguments) {

 

arguments.IsValid = getRadUpload(

'<%# upDetails.ClientID %>').validateExtensions();

 

}

and called this on ClientValidationFunction of custom validator. Now I have a requirement in which I would like to click on a button and that button takes text from email text box and checks the database for records containing that email address, Even if user does not fill other textboxes and only fill email textbox and click on check button it should bring the results via Ajax call and populate the Grid. I have designed all the functionality and it also works but the problem is on Ajax call the validators also work which I don't want and a javascript error also pop up saying 'null' is null or not an object and this error is because of the custom validation function shown above.

I am using AjaxManager and configured it to work on button click and selected the grid and sqldatasource as items for updating, in sqldatasource I decalared a variable @email for which I defined my email textbox as source control.

Is there anyway to make an ajax call without activating validators ? I hope I explained it properly, I am fairly new with ASP.NET and RadControls, I am/was a PHP programmer so all this stuff is new for me.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 03 Oct 2011, 01:30 PM
Hello Tahir,

On the button you don't want validation to occur, you can set the property CausesValidation="false", and that will bypass the validaton.

I hope that helps.
0
Tahir Ahmed
Top achievements
Rank 1
answered on 04 Oct 2011, 07:13 AM
Thanks kevin,

It solved the validation problem perfectly but now I am facing another problem, for some reason when I click a normal button that cause post back gives me a permission denied error but it only happens if I click this button after I clicked the ajax button. If I click post back button normally it does not cause this error but if I click it after ajax activity button it gives me permission denied error, any ideas ?

Thanks again.
0
Kevin
Top achievements
Rank 2
answered on 04 Oct 2011, 01:03 PM
Hello Tahir,

What is this permission denied error? I've never seen this kind of message before. Can you put the error message or a screenshot of the error message you receive when clicking that button.
Tags
Ajax
Asked by
Tahir Ahmed
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Tahir Ahmed
Top achievements
Rank 1
Share this question
or