Bug or Feature ;)

M

Meelis Lilbok

Hi

Im using ASP.NET 2.0.

On my page i have two textboxes txtUserName and txtPassword
and two RequiredFieldValidators' binded to each controls

Validate works fine only if i leave both textboxes empty or leave
txtPassword empty.
But when i enter some text in txtPassword field and let txtUserName empty
then validate does not work!

Must it be or is this a bug?


Regards;
Meelis
 
R

Ray Booysen

Meelis said:
Hi

Im using ASP.NET 2.0.

On my page i have two textboxes txtUserName and txtPassword
and two RequiredFieldValidators' binded to each controls

Validate works fine only if i leave both textboxes empty or leave
txtPassword empty.
But when i enter some text in txtPassword field and let txtUserName empty
then validate does not work!

Must it be or is this a bug?


Regards;
Meelis
Can you post your code?
 
M

Meelis Lilbok

Hi again

Found a problem!


This happens only then when i set AutoPostBack to True on txtPassword field.

If i set autopostback to false and click on login button, then validation
works ok.

Is it a still bug?

Meelis
 
J

Juan T. Llibre

Due to a timing issue with when page validation occurs, you must explicitly call the
Validate method to ensure that the values on the page are valid, if you use AutoPostBack.

Page.Validate()

Otherwise, set AutoPostBack to false,
and Page.Validate will be called automatically when the page is posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top