Page.IsPostback & Validation

  • Thread starter Thread starter Murphy
  • Start date Start date
M

Murphy

What is the best way to perform a 2 stage user input, for example in the
scenario where the user has forgotten their password:

Stage 1:
Request and validate the user's email address

Lookup the email and retrieve the secret question

Stage 2
Request and validate the user's answer to the secret question

Reset the password

As stage 2 cannot be performed until stage 1 has been submitted we can
perform this using 2 aspx pages although I'd prefer to use one page if
possible and use program logic to determine what stage we are up to and
display the appropriate user prompts.

Any comments on performing this task ?

Thanks

Murphy
 
Murphy said:
What is the best way to perform a 2 stage user input, for example in the
scenario where the user has forgotten their password:

Stage 1:
Request and validate the user's email address

Lookup the email and retrieve the secret question

Stage 2
Request and validate the user's answer to the secret question

Reset the password

As stage 2 cannot be performed until stage 1 has been submitted we can
perform this using 2 aspx pages although I'd prefer to use one page if
possible and use program logic to determine what stage we are up to and
display the appropriate user prompts.

Any comments on performing this task ?

Thanks

Murphy

Since this is quite simple, I would use panel controls to control the
visibility of each stage.
In Page_Load you can check which stage has been completed and set the
Visible property of the Panel controls as necessary.
 
Thanks Philip, this is the path I have taken, actually used a table with 4
rows and set the visible of the second two to false if it's the initial load
of the page. Interestingly the fourth row has a validation control yet this
does not appear to activate if the row is not visible !

When validation is done on the client all is well however if the client does
not support validation and the form is posted then validated by the server
and rejected is this considered a postback when it is redisplayed after
being rejected ?

Thanks

Murphy
 
Back
Top