Hi Guys,
We have an asp wizard set up that has some text boxes etc in it. We use RequiredFieldValidator for some of these and some other validators also.
The default behaviour seems to be that you can tab from field to field initially with no validation but after you press next it turns on the in-line validation that seems to happen on-the-fly.
Does anyone know if there is anyway to control this? i.e. it is on-the-fly all the time or only updates when next is pressed? (ideally the former)
Cheers.
Loading
Jaish MathewsPosted May 11, 2010, 5:36 AM
Vlidator will be fired on any click only. Just pressing tab won't fire validator controls. 1st check that this validation is from validatorcontrol itself.
Now You can make all validator control to "Enabled=False". Then none of them will fire. Later you can make them fire in click like below.
protected void Button1_Click(object sender, EventArgs e)
{
//Enabling ValidatorControl
RequiredFieldValidator1.Enabled = true;
//Firing all validator controls in page manually
Page.Validate();
//Check that specific ValidatorControl passed the validation or not. If passed, then only server activities
if (RequiredFieldValidator1.IsValid)
{
Response.Redirect("http://www.google.cpm");
}
}
NB:The above example only for a single ValidatorControl. You need to do this for each and evry ValidatorControls you have. You can use Page.Validators to loop through each and every ValidationControls of a page.
Jon HPosted May 11, 2010, 3:42 AM
I either wants constant on the fly validation i.e. validators flag as and when i leave cells.
OR
I want validation to only update when you press some button (next in my case as I am using a wizard)
Jon HPosted May 10, 2010, 10:22 AM
CrishPosted May 10, 2010, 10:18 AM
set causevalidation false for this button.
thanks
ajay rajuPosted May 10, 2010, 8:42 AM
Basically Validation controls of asp.net is validated on client - side. but first time it validate only you click submit button and next time also it validates client side not a server side validation.
if you want to show validtions when you click button you must write manual coding, (or) try to use validation summary control,
may be it helpful to you.
Thanks.