By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,657 Members | 1,029 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,657 IT Pros & Developers. It's quick & easy.

Accessing Wizard Next/Prev buttons

P: n/a
I have a Wizard page and need to affect the next and previous buttons from
my code-behind. I've googled around and found two solutions, and neither
appear to work.

I can access the SideBarList steps successfully with the following code...

Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer");
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList");
mySideBarList.Enabled = false;

Trying to take this approach with the StepNavigationTemplate does not seem
to work. I first converted the step navigation to a template but I cannot
get findcontrol to find anything in "StepNavigationContainer" or
"StepNavigationTemplate" or anything else I can think of.

I have also tried putting .hidden {display:none} in my .css file and ....

protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 3)
{
Wizard1.StepPreviousButtonStyle.CssClass = "hidden";
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
}

This has the effect of not working when goint to step 3 as the Prev/finish
still show. However if the prev button is hit, step 2 shows with the next
button not visible.

Is there a solution to this problem? Is there a reliable way to access
these buttons?

Thanks,
Gary

Jun 27 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Your code in the Wizard1_load event has the effect of not taking effect
until the user hits the previous button that was supposed to be non-visible.
then when we go back to step 2 the previous button is indeed visible.

This is another attempt in my code (I use the WizardStep activate and
deactivate events as I find them more reliable than the regular wizard
navigate events). This is very interesting....

Here I am disabling the datalist in the SideBarContainer and it works
immediately and just fine. the very code below it which I got from you also
appears to work when I step through it in debug mode i.e the PreviousButton
is found and it is set to non visible. But on the page when the step 4
shows the previous button is alive and well! Only when I hit that
previousbutton do I go back and, guess what, the previous button no longer
appears on step 2. In other words it happens a step late.

protected void WizardStep4_Activate(object sender, EventArgs e)
{
Session["curpage"] = "4";
//deactivate navigation capability throughout the wizard - the user
is done.

Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer");
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList");
mySideBarList.Enabled = false;

Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContain erID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton");
myPrevButton.Visible = false;

Pulling my hair out!
Gary

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:pe****************@TK2MSFTNGHUB02.phx.gbl...
Hi Gary,

As for the Wizard control, those different Container (such as Navigation
Panel , SideBar Panel...) , they're separate from each other (under the
Wizard control's Sub control colleciton). Therefore, if you want to lookup
any child control within any of them, you need to get reference to the
certain container first. Generally, a useful means to determine the
control structure/hierarchy is turn on page's output trace (see the below
directive):

=====================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CSWizard.aspx.cs"
Inherits="CSWizard"
Trace="true" %>

==================

And based on my test, the "Navigation container"'s control ID is
"StepNavigationTemplateContainerID". You can use it to get the Navigation
container control first, and call FindControl on it to get the
"MovePreviousButton" and "MoveNextButton".

here is a simple test page I've used. Also, "ActiveStepChanged" event is
not the proper event to lookup control collection (because at that time,
the new Step's control collection hasn't been populatd yet). I suggest you
use "Load" event.

=============aspx template ======
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="1"
onactivestepchanged="Wizard1_ActiveStepChanged"
onload="Wizard1_Load">
<WizardSteps>
<asp:WizardStep runat="server" title="Step 1">
<asp:Label ID="Label1" runat="server"
Text="Label1"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" Text="Button1"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" title="Step 2">
<asp:Label ID="Label2" runat="server"
Text="Label2"></asp:Label>
<br />
<asp:Button ID="Button2" runat="server" Text="Button2"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 3">
<asp:Label ID="Label3" runat="server"
Text="Label3"></asp:Label>
<br />
<asp:Button ID="Button3" runat="server" Text="Button3"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 4">
<asp:Label ID="Label4" runat="server"
Text="Label4"></asp:Label>
<br />
<asp:Button ID="Button4" runat="server" Text="Button4"
/>
</asp:WizardStep>
</WizardSteps>
<StepNavigationTemplate >
<asp:Button ID="StepPreviousButton" runat="server"
CausesValidation="False"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="StepNextButton" runat="server"
CommandName="MoveNext"
Text="Next" />
</StepNavigationTemplate>
</asp:Wizard>

==========code behind=========
protected void Wizard1_Load(object sender, EventArgs e)
{
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContain erID");

Response.Write("<br/>Wizard1_Load:");
Button btn1 = ctrl.FindControl("StepPreviousButton") as Button;
Button btn2 = ctrl.FindControl("StepNextButton") as Button;

Response.Write("<br/>" + btn1 + " | " + btn2);
}
}
======================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "GaryDean" <gd**********@newsgroup.nospam>
Subject: Accessing Wizard Next/Prev buttons
Date: Thu, 26 Jun 2008 10:59:43 -0600
>>
I have a Wizard page and need to affect the next and previous buttons from
my code-behind. I've googled around and found two solutions, and neither
appear to work.

I can access the SideBarList steps successfully with the following code...

Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer") ;
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList") ;
mySideBarList.Enabled = false;

Trying to take this approach with the StepNavigationTemplate does not seem
to work. I first converted the step navigation to a template but I cannot
get findcontrol to find anything in "StepNavigationContainer" or
"StepNavigationTemplate" or anything else I can think of.

I have also tried putting .hidden {display:none} in my .css file and ....

protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 3)
{
Wizard1.StepPreviousButtonStyle.CssClass = "hidden";
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
}

This has the effect of not working when goint to step 3 as the Prev/finish
still show. However if the prev button is hit, step 2 shows with the next
button not visible.

Is there a solution to this problem? Is there a reliable way to access
these buttons?

Thanks,
Gary

Jun 29 '08 #2

P: n/a
Thanks for your reply Gary,

Don't worry, I think there might be some status which hasn't been
maintained correctly here. To better test the behavior, would you send me a
simplified page which use a wizard control to demonstrate what you want to
do? thus, I can test against it on my side. You can reach me at the
following email address:

"stcheng" + @ + "microsoft.com"

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean" <gd**********@newsgroup.nospam>
References: <eC*************@TK2MSFTNGP06.phx.gbl>
<pe**************@TK2MSFTNGHUB02.phx.gbl>
>In-Reply-To: <pe**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: Accessing Wizard Next/Prev buttons
Date: Sat, 28 Jun 2008 18:51:32 -0600
>
Your code in the Wizard1_load event has the effect of not taking effect
until the user hits the previous button that was supposed to be
non-visible.
>then when we go back to step 2 the previous button is indeed visible.

This is another attempt in my code (I use the WizardStep activate and
deactivate events as I find them more reliable than the regular wizard
navigate events). This is very interesting....

Here I am disabling the datalist in the SideBarContainer and it works
immediately and just fine. the very code below it which I got from you
also
>appears to work when I step through it in debug mode i.e the
PreviousButton
>is found and it is set to non visible. But on the page when the step 4
shows the previous button is alive and well! Only when I hit that
previousbutton do I go back and, guess what, the previous button no longer
appears on step 2. In other words it happens a step late.

protected void WizardStep4_Activate(object sender, EventArgs e)
{
Session["curpage"] = "4";
//deactivate navigation capability throughout the wizard - the
user
>is done.

Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer" );
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList" );
mySideBarList.Enabled = false;

Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContai nerID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton");
myPrevButton.Visible = false;

Pulling my hair out!
Gary

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:pe****************@TK2MSFTNGHUB02.phx.gbl. ..
>Hi Gary,

As for the Wizard control, those different Container (such as Navigation
Panel , SideBar Panel...) , they're separate from each other (under the
Wizard control's Sub control colleciton). Therefore, if you want to
lookup
>any child control within any of them, you need to get reference to the
certain container first. Generally, a useful means to determine the
control structure/hierarchy is turn on page's output trace (see the below
directive):

=====================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CSWizard.aspx.cs"
Inherits="CSWizard"
Trace="true" %>

==================

And based on my test, the "Navigation container"'s control ID is
"StepNavigationTemplateContainerID". You can use it to get the
Navigation
>container control first, and call FindControl on it to get the
"MovePreviousButton" and "MoveNextButton".

here is a simple test page I've used. Also, "ActiveStepChanged" event is
not the proper event to lookup control collection (because at that time,
the new Step's control collection hasn't been populatd yet). I suggest
you
>use "Load" event.

=============aspx template ======
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="1"
onactivestepchanged="Wizard1_ActiveStepChanged"
onload="Wizard1_Load">
<WizardSteps>
<asp:WizardStep runat="server" title="Step 1">
<asp:Label ID="Label1" runat="server"
Text="Label1"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" Text="Button1"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" title="Step 2">
<asp:Label ID="Label2" runat="server"
Text="Label2"></asp:Label>
<br />
<asp:Button ID="Button2" runat="server" Text="Button2"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 3">
<asp:Label ID="Label3" runat="server"
Text="Label3"></asp:Label>
<br />
<asp:Button ID="Button3" runat="server" Text="Button3"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 4">
<asp:Label ID="Label4" runat="server"
Text="Label4"></asp:Label>
<br />
<asp:Button ID="Button4" runat="server" Text="Button4"
/>
</asp:WizardStep>
</WizardSteps>
<StepNavigationTemplate >
<asp:Button ID="StepPreviousButton" runat="server"
CausesValidation="False"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="StepNextButton" runat="server"
CommandName="MoveNext"
Text="Next" />
</StepNavigationTemplate>
</asp:Wizard>

==========code behind=========
protected void Wizard1_Load(object sender, EventArgs e)
{
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContai nerID");

Response.Write("<br/>Wizard1_Load:");
Button btn1 = ctrl.FindControl("StepPreviousButton") as Button;
Button btn2 = ctrl.FindControl("StepNextButton") as Button;

Response.Write("<br/>" + btn1 + " | " + btn2);
}
}
======================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>>From: "GaryDean" <gd**********@newsgroup.nospam>
Subject: Accessing Wizard Next/Prev buttons
Date: Thu, 26 Jun 2008 10:59:43 -0600
>>>
I have a Wizard page and need to affect the next and previous buttons
from
>>>my code-behind. I've googled around and found two solutions, and neither
appear to work.

I can access the SideBarList steps successfully with the following
code...
>>>
Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer" );
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList" );
mySideBarList.Enabled = false;

Trying to take this approach with the StepNavigationTemplate does not
seem
>>>to work. I first converted the step navigation to a template but I
cannot
>>>get findcontrol to find anything in "StepNavigationContainer" or
"StepNavigationTemplate" or anything else I can think of.

I have also tried putting .hidden {display:none} in my .css file and ....

protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 3)
{
Wizard1.StepPreviousButtonStyle.CssClass = "hidden";
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
}

This has the effect of not working when goint to step 3 as the
Prev/finish
>>>still show. However if the prev button is hit, step 2 shows with the
next
>>>button not visible.

Is there a solution to this problem? Is there a reliable way to access
these buttons?

Thanks,
Gary


Jul 1 '08 #3

P: n/a
Yes but it might be a few days.
Thanks.
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:hD**************@TK2MSFTNGHUB02.phx.gbl...
Thanks for your reply Gary,

Don't worry, I think there might be some status which hasn't been
maintained correctly here. To better test the behavior, would you send me
a
simplified page which use a wizard control to demonstrate what you want to
do? thus, I can test against it on my side. You can reach me at the
following email address:

"stcheng" + @ + "microsoft.com"

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "GaryDean" <gd**********@newsgroup.nospam>
References: <eC*************@TK2MSFTNGP06.phx.gbl>
<pe**************@TK2MSFTNGHUB02.phx.gbl>
>>In-Reply-To: <pe**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: Accessing Wizard Next/Prev buttons
Date: Sat, 28 Jun 2008 18:51:32 -0600
>>
Your code in the Wizard1_load event has the effect of not taking effect
until the user hits the previous button that was supposed to be
non-visible.
>>then when we go back to step 2 the previous button is indeed visible.

This is another attempt in my code (I use the WizardStep activate and
deactivate events as I find them more reliable than the regular wizard
navigate events). This is very interesting....

Here I am disabling the datalist in the SideBarContainer and it works
immediately and just fine. the very code below it which I got from you
also
>>appears to work when I step through it in debug mode i.e the
PreviousButton
>>is found and it is set to non visible. But on the page when the step 4
shows the previous button is alive and well! Only when I hit that
previousbutton do I go back and, guess what, the previous button no longer
appears on step 2. In other words it happens a step late.

protected void WizardStep4_Activate(object sender, EventArgs e)
{
Session["curpage"] = "4";
//deactivate navigation capability throughout the wizard - the
user
>>is done.

Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer") ;
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList") ;
mySideBarList.Enabled = false;

Control ctrl =
Wizard1.FindControl("StepNavigationTemplateConta inerID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton") ;
myPrevButton.Visible = false;

Pulling my hair out!
Gary

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:pe****************@TK2MSFTNGHUB02.phx.gbl.. .
>>Hi Gary,

As for the Wizard control, those different Container (such as Navigation
Panel , SideBar Panel...) , they're separate from each other (under the
Wizard control's Sub control colleciton). Therefore, if you want to
lookup
>>any child control within any of them, you need to get reference to the
certain container first. Generally, a useful means to determine the
control structure/hierarchy is turn on page's output trace (see the
below
directive):

=====================
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="CSWizard.aspx.cs"
Inherits="CSWizard"
Trace="true" %>

==================

And based on my test, the "Navigation container"'s control ID is
"StepNavigationTemplateContainerID". You can use it to get the
Navigation
>>container control first, and call FindControl on it to get the
"MovePreviousButton" and "MoveNextButton".

here is a simple test page I've used. Also, "ActiveStepChanged" event
is
not the proper event to lookup control collection (because at that time,
the new Step's control collection hasn't been populatd yet). I suggest
you
>>use "Load" event.

=============aspx template ======
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="1"
onactivestepchanged="Wizard1_ActiveStepChanged"
onload="Wizard1_Load">
<WizardSteps>
<asp:WizardStep runat="server" title="Step 1">
<asp:Label ID="Label1" runat="server"
Text="Label1"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server"
Text="Button1"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" title="Step 2">
<asp:Label ID="Label2" runat="server"
Text="Label2"></asp:Label>
<br />
<asp:Button ID="Button2" runat="server"
Text="Button2"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 3">
<asp:Label ID="Label3" runat="server"
Text="Label3"></asp:Label>
<br />
<asp:Button ID="Button3" runat="server"
Text="Button3"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 4">
<asp:Label ID="Label4" runat="server"
Text="Label4"></asp:Label>
<br />
<asp:Button ID="Button4" runat="server"
Text="Button4"
/>
</asp:WizardStep>
</WizardSteps>
<StepNavigationTemplate >
<asp:Button ID="StepPreviousButton" runat="server"
CausesValidation="False"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="StepNextButton" runat="server"
CommandName="MoveNext"
Text="Next" />
</StepNavigationTemplate>
</asp:Wizard>

==========code behind=========
protected void Wizard1_Load(object sender, EventArgs e)
{
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateConta inerID");

Response.Write("<br/>Wizard1_Load:");
Button btn1 = ctrl.FindControl("StepPreviousButton") as Button;
Button btn2 = ctrl.FindControl("StepNextButton") as Button;

Response.Write("<br/>" + btn1 + " | " + btn2);
}
}
======================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
>>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================ ==
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================ ==
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "GaryDean" <gd**********@newsgroup.nospam>
Subject: Accessing Wizard Next/Prev buttons
Date: Thu, 26 Jun 2008 10:59:43 -0600
I have a Wizard page and need to affect the next and previous buttons
from
>>>>my code-behind. I've googled around and found two solutions, and
neither
appear to work.

I can access the SideBarList steps successfully with the following
code...
>>>>
Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer ");
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList ");
mySideBarList.Enabled = false;

Trying to take this approach with the StepNavigationTemplate does not
seem
>>>>to work. I first converted the step navigation to a template but I
cannot
>>>>get findcontrol to find anything in "StepNavigationContainer" or
"StepNavigationTemplate" or anything else I can think of.

I have also tried putting .hidden {display:none} in my .css file and
....

protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 3)
{
Wizard1.StepPreviousButtonStyle.CssClass = "hidden";
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
}

This has the effect of not working when goint to step 3 as the
Prev/finish
>>>>still show. However if the prev button is hit, step 2 shows with the
next
>>>>button not visible.

Is there a solution to this problem? Is there a reliable way to access
these buttons?

Thanks,
Gary

Jul 1 '08 #4

P: n/a
Thanks for your reply Gary,

No problem. Please feel free to let me know at your convenience.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean" <gd**********@newsgroup.nospam>
References: <eC*************@TK2MSFTNGP06.phx.gbl>
<pe**************@TK2MSFTNGHUB02.phx.gbl>
<#F**************@TK2MSFTNGP03.phx.gbl>
<hD**************@TK2MSFTNGHUB02.phx.gbl>
>In-Reply-To: <hD**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: Accessing Wizard Next/Prev buttons
Date: Tue, 1 Jul 2008 17:24:35 -0600
>
Yes but it might be a few days.
Thanks.
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:hD**************@TK2MSFTNGHUB02.phx.gbl...
>Thanks for your reply Gary,

Don't worry, I think there might be some status which hasn't been
maintained correctly here. To better test the behavior, would you send
me
>a
simplified page which use a wizard control to demonstrate what you want
to
>do? thus, I can test against it on my side. You can reach me at the
following email address:

"stcheng" + @ + "microsoft.com"

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications.

================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>>From: "GaryDean" <gd**********@newsgroup.nospam>
References: <eC*************@TK2MSFTNGP06.phx.gbl>
<pe**************@TK2MSFTNGHUB02.phx.gbl>
>>>In-Reply-To: <pe**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: Accessing Wizard Next/Prev buttons
Date: Sat, 28 Jun 2008 18:51:32 -0600
>>>
Your code in the Wizard1_load event has the effect of not taking effect
until the user hits the previous button that was supposed to be
non-visible.
>>>then when we go back to step 2 the previous button is indeed visible.

This is another attempt in my code (I use the WizardStep activate and
deactivate events as I find them more reliable than the regular wizard
navigate events). This is very interesting....

Here I am disabling the datalist in the SideBarContainer and it works
immediately and just fine. the very code below it which I got from you
also
>>>appears to work when I step through it in debug mode i.e the
PreviousButton
>>>is found and it is set to non visible. But on the page when the step 4
shows the previous button is alive and well! Only when I hit that
previousbutton do I go back and, guess what, the previous button no
longer
>>>appears on step 2. In other words it happens a step late.

protected void WizardStep4_Activate(object sender, EventArgs e)
{
Session["curpage"] = "4";
//deactivate navigation capability throughout the wizard - the
user
>>>is done.

Control myContainer =
(Control)Wizard1.FindControl("SideBarContainer" );
DataList mySideBarList =
(DataList)myContainer.FindControl("SideBarList" );
mySideBarList.Enabled = false;

Control ctrl =
Wizard1.FindControl("StepNavigationTemplateCont ainerID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton" );
myPrevButton.Visible = false;

Pulling my hair out!
Gary

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:pe****************@TK2MSFTNGHUB02.phx.gbl. ..
Hi Gary,

As for the Wizard control, those different Container (such as
Navigation
>>>Panel , SideBar Panel...) , they're separate from each other (under the
Wizard control's Sub control colleciton). Therefore, if you want to
lookup
>>>any child control within any of them, you need to get reference to the
certain container first. Generally, a useful means to determine the
control structure/hierarchy is turn on page's output trace (see the
below
directive):

=====================
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="CSWizard.aspx.cs"
Inherits="CSWizard"
Trace="true" %>

==================

And based on my test, the "Navigation container"'s control ID is
"StepNavigationTemplateContainerID". You can use it to get the
Navigation
>>>container control first, and call FindControl on it to get the
"MovePreviousButton" and "MoveNextButton".

here is a simple test page I've used. Also, "ActiveStepChanged" event
is
not the proper event to lookup control collection (because at that
time,
>>>the new Step's control collection hasn't been populatd yet). I suggest
you
>>>use "Load" event.

=============aspx template ======
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="1"
onactivestepchanged="Wizard1_ActiveStepChanged"
onload="Wizard1_Load">
<WizardSteps>
<asp:WizardStep runat="server" title="Step 1">
<asp:Label ID="Label1" runat="server"
Text="Label1"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server"
Text="Button1"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" title="Step 2">
<asp:Label ID="Label2" runat="server"
Text="Label2"></asp:Label>
<br />
<asp:Button ID="Button2" runat="server"
Text="Button2"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 3">
<asp:Label ID="Label3" runat="server"
Text="Label3"></asp:Label>
<br />
<asp:Button ID="Button3" runat="server"
Text="Button3"
/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 4">
<asp:Label ID="Label4" runat="server"
Text="Label4"></asp:Label>
<br />
<asp:Button ID="Button4" runat="server"
Text="Button4"
/>
</asp:WizardStep>
</WizardSteps>
<StepNavigationTemplate >
<asp:Button ID="StepPreviousButton" runat="server"
CausesValidation="False"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="StepNextButton" runat="server"
CommandName="MoveNext"
Text="Next" />
</StepNavigationTemplate>
</asp:Wizard>

==========code behind=========
protected void Wizard1_Load(object sender, EventArgs e)
{
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateCont ainerID");

Response.Write("<br/>Wizard1_Load:");
Button btn1 = ctrl.FindControl("StepPreviousButton") as Button;
Button btn2 = ctrl.FindControl("StepNextButton") as Button;

Response.Write("<br/>" + btn1 + " | " + btn2);
}
}
======================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
>>>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

=============================================== ===
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>>>ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>>>where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
>>>up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============================================== ===
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>From: "GaryDean" <gd**********@newsgroup.nospam>
>Subject: Accessing Wizard Next/Prev buttons
>Date: Thu, 26 Jun 2008 10:59:43 -0600

>
>I have a Wizard page and need to affect the next and previous buttons
from
>>>>>my code-behind. I've googled around and found two solutions, and
>neither
>appear to work.
>
>I can access the SideBarList steps successfully with the following
code...
>>>>>
Control myContainer =
>(Control)Wizard1.FindControl("SideBarContaine r");
DataList mySideBarList =
>(DataList)myContainer.FindControl("SideBarLis t");
mySideBarList.Enabled = false;
>
>Trying to take this approach with the StepNavigationTemplate does not
seem
>>>>>to work. I first converted the step navigation to a template but I
cannot
>>>>>get findcontrol to find anything in "StepNavigationContainer" or
>"StepNavigationTemplate" or anything else I can think of.
>
>I have also tried putting .hidden {display:none} in my .css file and
>....
>
protected void Wizard1_ActiveStepChanged(object sender, EventArgs
e)
>>>> {
if (Wizard1.ActiveStepIndex == 3)
{
Wizard1.StepPreviousButtonStyle.CssClass = "hidden";
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
}
>
>This has the effect of not working when goint to step 3 as the
Prev/finish
>>>>>still show. However if the prev button is hit, step 2 shows with the
next
>>>>>button not visible.
>
>Is there a solution to this problem? Is there a reliable way to access
>these buttons?
>
>Thanks,
>Gary
>
>

Jul 2 '08 #5

P: n/a

Hi Gary,

I have performed some test against the sample page you provided. Here are
some of my test results according to your previous reply in the newsgroup
thread:

1. At the beginning, both next/previous buttons and side bar links can help
navigate between steps
2. After I reach the final step(step4), sidebar is disabled, and I can only
move to previous step via "previous" button.
3. However, when I move to step2, the previous button still exists(per your
description in newsgroup, this button disappear in step2?). And only if I
reach step1 will the "previous" button disappear.

So far, what I'm not clear is why don't you also disable "Previous button"
when reach step4, but only disable the sidebar? Also, if there is any
other problems here, please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Jul 8 '08 #6

P: n/a
Hi Gary,

After some further research, I've figured out the problem.

Actually, we've made a mistake when locating the "PreviousButton" on the
last step(the finish step). We originally use the following code:

============
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContain erID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton");
myPrevButton.Visible = false;

============

this is ok for intermediate step, however, for the finish step/end step,
you need to search for the "previousButton" in a different Container called
"FinishNavigationTemplateContainerID", also the Button ID is different.
Here is the code I've used to make the "previous button" in last step
disabled. The code contains two part:

1. mark a flag(in session) indicate that we've reach the end

2. in "PreRender" event of the wizard, we check the flag and determine
whether to disable the button
=========================
protected void WizardStep4_Activate(object sender, EventArgs e)
{
......................

Session["finish"] = true;

}

==========================

protected void Wizard1_PreRender(object sender, EventArgs e)
{
if (Session["finish"] != null)
{
Control ctrl =
Wizard1.FindControl("FinishNavigationTemplateConta inerID");
Button myPrevButton =
(Button)ctrl.FindControl("FinishPreviousButton");
myPrevButton.Enabled = false;
}

}
=========================

Hope this helps. I'll also send you the modified project via email.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>X-Tomcat-ID: 8069796
Date: Tue, 08 Jul 2008 09:33:48 GMT
Subject: Re: Accessing Wizard Next/Prev buttons
>
Hi Gary,

I have performed some test against the sample page you provided. Here are
some of my test results according to your previous reply in the newsgroup
thread:

1. At the beginning, both next/previous buttons and side bar links can
help
>navigate between steps
2. After I reach the final step(step4), sidebar is disabled, and I can
only
>move to previous step via "previous" button.
3. However, when I move to step2, the previous button still exists(per
your
>description in newsgroup, this button disappear in step2?). And only if I
reach step1 will the "previous" button disappear.

So far, what I'm not clear is why don't you also disable "Previous button"
when reach step4, but only disable the sidebar? Also, if there is any
other problems here, please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ault.aspx#noti
f
>ications.

Jul 10 '08 #7

P: n/a
Steven:
Wow. that did it! I don't think I would have ever figured this out.
Thanks for your help.
Gary

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:4y**************@TK2MSFTNGHUB02.phx.gbl...
Hi Gary,

After some further research, I've figured out the problem.

Actually, we've made a mistake when locating the "PreviousButton" on the
last step(the finish step). We originally use the following code:

============
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContain erID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton");
myPrevButton.Visible = false;

============

this is ok for intermediate step, however, for the finish step/end step,
you need to search for the "previousButton" in a different Container
called
"FinishNavigationTemplateContainerID", also the Button ID is different.
Here is the code I've used to make the "previous button" in last step
disabled. The code contains two part:

1. mark a flag(in session) indicate that we've reach the end

2. in "PreRender" event of the wizard, we check the flag and determine
whether to disable the button
=========================
protected void WizardStep4_Activate(object sender, EventArgs e)
{
......................

Session["finish"] = true;

}

==========================

protected void Wizard1_PreRender(object sender, EventArgs e)
{
if (Session["finish"] != null)
{
Control ctrl =
Wizard1.FindControl("FinishNavigationTemplateConta inerID");
Button myPrevButton =
(Button)ctrl.FindControl("FinishPreviousButton");
myPrevButton.Enabled = false;
}

}
=========================

Hope this helps. I'll also send you the modified project via email.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>X-Tomcat-ID: 8069796
Date: Tue, 08 Jul 2008 09:33:48 GMT
Subject: Re: Accessing Wizard Next/Prev buttons
>>
Hi Gary,

I have performed some test against the sample page you provided. Here are
some of my test results according to your previous reply in the newsgroup
thread:

1. At the beginning, both next/previous buttons and side bar links can
help
>>navigate between steps
2. After I reach the final step(step4), sidebar is disabled, and I can
only
>>move to previous step via "previous" button.
3. However, when I move to step2, the previous button still exists(per
your
>>description in newsgroup, this button disappear in step2?). And only if I
reach step1 will the "previous" button disappear.

So far, what I'm not clear is why don't you also disable "Previous button"
when reach step4, but only disable the sidebar? Also, if there is any
other problems here, please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================ ==
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ault.aspx#noti
f
>>ications.

Jul 11 '08 #8

P: n/a
Hi Gary,

I'm also very glad that it helps you resolve the problem.

If you have any other questions later, always feel free to post in the
newsgroup.

Have a nice day!

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean" <gd**********@newsgroup.nospam>
Subject: Re: Accessing Wizard Next/Prev buttons
Date: Thu, 10 Jul 2008 18:26:11 -0600
>
Steven:
Wow. that did it! I don't think I would have ever figured this out.
Thanks for your help.
Gary

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:4y**************@TK2MSFTNGHUB02.phx.gbl...
>Hi Gary,

After some further research, I've figured out the problem.

Actually, we've made a mistake when locating the "PreviousButton" on the
last step(the finish step). We originally use the following code:

============
Control ctrl =
Wizard1.FindControl("StepNavigationTemplateContai nerID");
Button myPrevButton =
(Button)ctrl.FindControl("StepPreviousButton");
myPrevButton.Visible = false;

============

this is ok for intermediate step, however, for the finish step/end step,
you need to search for the "previousButton" in a different Container
called
"FinishNavigationTemplateContainerID", also the Button ID is different.
Here is the code I've used to make the "previous button" in last step
disabled. The code contains two part:

1. mark a flag(in session) indicate that we've reach the end

2. in "PreRender" event of the wizard, we check the flag and determine
whether to disable the button
=========================
protected void WizardStep4_Activate(object sender, EventArgs e)
{
......................

Session["finish"] = true;

}

==========================

protected void Wizard1_PreRender(object sender, EventArgs e)
{
if (Session["finish"] != null)
{
Control ctrl =
Wizard1.FindControl("FinishNavigationTemplateCont ainerID");
Button myPrevButton =
(Button)ctrl.FindControl("FinishPreviousButton" );
myPrevButton.Enabled = false;
}

Jul 11 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.