views:

843

answers:

2

Hi In my .aspx form I have a textbox (Textbox1) with Autopostback=True. I also set a RequiredFieldValidator (RequiredFieldValidator1) next to it. But when Posting back by TextChanged event of Textbox1, RequiredFieldValidator1 appears but still I can submit my form with nothing into the Textbox1!

what's wrong?

+2  A: 

You have to set the textbox's CausesValidation property to true (it's set to false by default for textboxes).

Immortal
thank you but still the form submits. How do I change the code so that the form doesn't submit?
odiseh
I tested the scenario you've given and it worked. Maybe you should post some of your code.
Immortal
A: 

give both the text box and the submit button the same validation group ...

freddy khalaf