Home All Groups Group Topic Archive Search About
Author
22 Dec 2005 8:17 PM
rdlauer
I'm in a catch-22 with a wizard control and wonder if anyone has any
ideas:

It appears as though every time you load a wizard control step, you are
doing a postback, which makes sense. That causes problems, though, when
you have actions in a step that should only be executed if IsPostBack =
False (which will never be true on any step greater than #1). Example:

I have a two (or more) step process that I'm using a wizard control
for. I wrote a method called "OnNext" that is called every time I hit
the "next" button in my control.

The 1st wizard step is just a textbox (txtStep1). The 2nd wizard step
is also just a textbox (txtStep2).

On WizardStep2.Load, I set txtStep2.Text = txtStep1.Text. However, this
should ONLY happen if IsPostBack = False, otherwise any user entry into
txtStep2.Text will be overwritten by txtStep1 (in case of a validator
going off or whatever) again.

The catch is that WizardStep2.Load is, in itself, a postback, since
we're really doing a postback from Step1.

I feel like I'm missing some really obvious wizard control option here,
but I just can't figure this out. Thanks in advance for any help.

Author
28 Dec 2005 11:57 PM
Mike MacMillan
rdlauer,
  this is an issue i came across a while back when authoring my own
wizard control.  since each step postsback, testing the IsPostBack
property is useless (as you said).  my work around was for each step to
define a property that persists its value in viewstate.  this way, if
you ever go further then one postback away from a step, it will lose
its viewstate value, letting you know you need to reinitialize its
data.  as for persisting whether a step is complete or not, you can
either use a session object, or integrate the step data into the
viewstate via overriding the Load and SaveViewState methods in the base
wizard class.

  hope this helps,
  Mike MacMillan



rdla***@gmail.com wrote:
Show quoteHide quote
> I'm in a catch-22 with a wizard control and wonder if anyone has any
> ideas:
>
> It appears as though every time you load a wizard control step, you are
> doing a postback, which makes sense. That causes problems, though, when
> you have actions in a step that should only be executed if IsPostBack =
> False (which will never be true on any step greater than #1). Example:
>
> I have a two (or more) step process that I'm using a wizard control
> for. I wrote a method called "OnNext" that is called every time I hit
> the "next" button in my control.
>
> The 1st wizard step is just a textbox (txtStep1). The 2nd wizard step
> is also just a textbox (txtStep2).
>
> On WizardStep2.Load, I set txtStep2.Text = txtStep1.Text. However, this
> should ONLY happen if IsPostBack = False, otherwise any user entry into
> txtStep2.Text will be overwritten by txtStep1 (in case of a validator
> going off or whatever) again.
>
> The catch is that WizardStep2.Load is, in itself, a postback, since
> we're really doing a postback from Step1.
>
> I feel like I'm missing some really obvious wizard control option here,
> but I just can't figure this out. Thanks in advance for any help.
Author
29 Dec 2005 6:26 PM
rdlauer
Thanks for the reply. I ended up using a hidden field on each step with
a default value of "no" and an id of "StepX_Submitted". In the step
load method, I check to see if that value is "no"...if so, execute some
code. In my OnNext method (executed whenever the "next" button is
clicked) I set the value for the hidden field on that step to be "yes".

Not very elegant, but it works. I'd be interested to hear how this is
"supposed" to be done though! Thanks.