about the use of validator control in asp.net
-
I have one question in using validator control in ASP.net: let's say, I have a validator bound to a textbox, just to check whether the text is empty or not. I only want the validator checks the textbox when I click some button (such as submit), but I found that the validator also works when I do not click this button. e.g. even I try to redirect to other page, the validator still checks and I can not redirect to other page. I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions? thanks!!
-
I have one question in using validator control in ASP.net: let's say, I have a validator bound to a textbox, just to check whether the text is empty or not. I only want the validator checks the textbox when I click some button (such as submit), but I found that the validator also works when I do not click this button. e.g. even I try to redirect to other page, the validator still checks and I can not redirect to other page. I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions? thanks!!
Seraph_summer wrote:
I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions?
Yes, That is
ValidationGroup
Property In your case,Textbox
,Submit button
andRequiredFiledValidator
Should have same ValidationGroup. For your Referecne : VAlidation Group[^] Hope this will help you :-DAbhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
I have one question in using validator control in ASP.net: let's say, I have a validator bound to a textbox, just to check whether the text is empty or not. I only want the validator checks the textbox when I click some button (such as submit), but I found that the validator also works when I do not click this button. e.g. even I try to redirect to other page, the validator still checks and I can not redirect to other page. I am wondering, is there any property I can use to handle this problem directly except I use enable and disable functions? thanks!!
-
thanks for both o you! I got it!