Connecting Tech Pros Worldwide Help | Site Map

RegularExpressionValidator fire with postback

Newbie
 
Join Date: Apr 2009
Posts: 18
#1: May 6 '09
I have RegularExpression Validator which check textbox has some text fortmat. It should fire client side but it fire with postback. How to prevent postback????
Familiar Sight
 
Join Date: Mar 2008
Posts: 141
#2: May 6 '09

re: RegularExpressionValidator fire with postback


It is a server control. You can not prevent postback. It works as designed.
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#3: May 7 '09

re: RegularExpressionValidator fire with postback


It's a server control but it should run JavaScript client side to do validation first.

What is your Regular Expression?


If your regular expression is incorrect then it may be allowing invalid data to post back to the server.
maliksleo's Avatar
Member
 
Join Date: Feb 2009
Location: Islamabad, Pakistan
Posts: 115
#4: May 8 '09

re: RegularExpressionValidator fire with postback


Quote:

Originally Posted by akshalika View Post

I have RegularExpression Validator which check textbox has some text fortmat. It should fire client side but it fire with postback. How to prevent postback????

the client side code works only on clients machine and the postback is a server side process. So when you start entering text the client side code works and thats why you have this thing. I think its not a problem at all its a good feature of regular expression.
But in your case i think you want to do some thing in postback first then you want to go further.
I think by making of group for validators you may not have this problem any more.

maliksleo
Reply