J
JJ
I have two related problems:
(a). trying to set the default button within a CreateUserWizard control
-----------------------------------------------------------------
I've done this in a messy way (see below) and wonder if anyone know how I
could have done it using nested FindControl's and ClientID/UniqueID (I tried
jst about every combination!)
The button names you see in the code were obtained by viewing the source of
the html pages. I was hoping I could use something like:
Master.Page.Form.DefaultButton =
Wizard1.ActiveStep.FindControl("CreateUserWizard1").FindControl("btn_CreateUser").UniqueID
- but I just couldn't get this or any combination of it to work. So my
current code to set the deafult button is:
protected void Page_Load(object sender, EventArgs e)
{
Control theButton;
int StepIndex = CreateUserWizard1.ActiveStepIndex;
if (StepIndex == 0)
{
theButton =
this.FindControl("ctl00$MainContent$CreateUserWizard1$__CustomNav0$btn_CreateUserButton");
}
else
{
theButton =
this.FindControl("ctl00$MainContent$CreateUserWizard1$CompleteStepContainer$ContinueButton");
}
Master.Page.Form.DefaultButton = theButton.UniqueID;
}
(b) Detecting when we're at the 'Complete' step
------------------------------------------------
In the above code you'll notice I am checking for the StepIndex. However, I
notice this only changes when the 'Complete' button is clicked on the second
stage!
i.e. after clicking the 'Create User' button on step 1 (StepIndex '0') the
next page appears with my complete step template information and a
'complete' button at the bottom.
yet the StepIndex is still '0'. Only when I click on the 'Continue' button
does it change to '1'.
In which case am I checking the index at the wrong point? How do I detect
when the user is viewing the 'Complete' step?
JJ
(a). trying to set the default button within a CreateUserWizard control
-----------------------------------------------------------------
I've done this in a messy way (see below) and wonder if anyone know how I
could have done it using nested FindControl's and ClientID/UniqueID (I tried
jst about every combination!)
The button names you see in the code were obtained by viewing the source of
the html pages. I was hoping I could use something like:
Master.Page.Form.DefaultButton =
Wizard1.ActiveStep.FindControl("CreateUserWizard1").FindControl("btn_CreateUser").UniqueID
- but I just couldn't get this or any combination of it to work. So my
current code to set the deafult button is:
protected void Page_Load(object sender, EventArgs e)
{
Control theButton;
int StepIndex = CreateUserWizard1.ActiveStepIndex;
if (StepIndex == 0)
{
theButton =
this.FindControl("ctl00$MainContent$CreateUserWizard1$__CustomNav0$btn_CreateUserButton");
}
else
{
theButton =
this.FindControl("ctl00$MainContent$CreateUserWizard1$CompleteStepContainer$ContinueButton");
}
Master.Page.Form.DefaultButton = theButton.UniqueID;
}
(b) Detecting when we're at the 'Complete' step
------------------------------------------------
In the above code you'll notice I am checking for the StepIndex. However, I
notice this only changes when the 'Complete' button is clicked on the second
stage!
i.e. after clicking the 'Create User' button on step 1 (StepIndex '0') the
next page appears with my complete step template information and a
'complete' button at the bottom.
yet the StepIndex is still '0'. Only when I click on the 'Continue' button
does it change to '1'.
In which case am I checking the index at the wrong point? How do I detect
when the user is viewing the 'Complete' step?
JJ