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

asp:Wizard control - hiding "next" button on certain steps.

P: n/a
Hi,

I'm using the asp:Wizard control and on some of the steps, I would only
like the user to be able to progess to the next step by clicking an
image button. Therefore I would like to be able to hide the Next button
on these steps.

Is there any way to do this?

I know you can convert the navigation to a template, but this is a
common template for all steps rather than a template for a particular step.

Thanks,

Nick...
Dec 12 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Nick,

You can use following steps to hide or show each step's next/prev button:

1) Add following CSS rules to your ASPX:

<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.hidden { display: none; }
.visible { display: inline; }
</style>
</head>
You can find more information about CSS display here:

#CSS2 - The display declaration
http://www.quirksmode.org/css/display.html


2) Handle the Wizard's ActiveStepChanged event:

protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 1)
{
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
else
{
Wizard1.StepPreviousButtonStyle.CssClass = "visible";
Wizard1.StepNextButtonStyle.CssClass = "visible";
}
}
Hope this helps.
Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

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.

Dec 13 '06 #2

P: n/a
Thanks Walter. I hadn't thought of doing that. It's a shame you can't
have per-step templates because this solution seems a bit of a hack to
me. It would be nicer if you could set which buttons appear in each step
in the step declaration or a template inside the step.

I have since had another idea which I might use:
I can simply hide the buttons completely by using an empty template then
add back in the buttons I need manually in the WizardStep template. I
can then change the active step in the onclick handler for those buttons.

Thanks,

Nick...
Dec 15 '06 #3

P: n/a
Actually, this turns out to be much easier than I thought.

If you want to customise when the next and previous buttons appear you
just need to do the following:

1. In design view, select "convert to StepNavigationTemplate" on the Wizard.
2. Copy the next and previous buttons into the templates for the steps
that require them. (the only important thing is that the CommandName is
either MoveNext or MovePrevious.

3. Delete the contents of the StepNavigationTemplate to avoid duplicate
buttons:

<StepNavigationTemplate></StepNavigationTemplate>

Done! The buttons work automatically with no additional code as the
Wizard control just seems to check the CommandName on postback.

This means you can use LinkButtons or ImageButtons too in the same way
as long as the commandname is the same.

Nick...
Walter Wang [MSFT] wrote:
Hi Nick,

You can use following steps to hide or show each step's next/prev button:

1) Add following CSS rules to your ASPX:

<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.hidden { display: none; }
.visible { display: inline; }
</style>
</head>
You can find more information about CSS display here:

#CSS2 - The display declaration
http://www.quirksmode.org/css/display.html


2) Handle the Wizard's ActiveStepChanged event:

protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 1)
{
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
else
{
Wizard1.StepPreviousButtonStyle.CssClass = "visible";
Wizard1.StepNextButtonStyle.CssClass = "visible";
}
}
Hope this helps.
Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

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.
Dec 15 '06 #4

P: n/a
Hi Nick,

Thank you for sharing your solution. You're right that it's the CommandName
of a control that supports bubbling event controls Next or Previous step.
By removing the default StepNavigationTemplate content and using
CommandName, you have full control of how to show the navigation controls.
For more information about event bubbling:

#Bubbling an Event
http://msdn2.microsoft.com/en-gb/lib...44(VS.71).aspx

#Control.RaiseBubbleEvent Method (System.Web.UI)
http://msdn2.microsoft.com/en-us/lib....raisebubbleev
ent.aspx

#Event Bubbling Control Sample
http://msdn2.microsoft.com/en-gb/lib...44(VS.71).aspx
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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

Dec 18 '06 #5

P: n/a
Hi

Please give some working code on how to access the next and previous
buttons. In which event I will write the code

Thanks

Arun

On Dec 15 2006, 8:10 pm, Nick Gilbert <n...@newsgroup.nospamwrote:
Actually, this turns out to be much easier than I thought.

If you want to customise when thenextand previous buttons appear you
just need to do the following:

1. In design view, select "convert to StepNavigationTemplate" on theWizard.
2. Copy thenextand previous buttons into the templates for the steps
that require them. (the only important thing is that the CommandName is
either MoveNext or MovePrevious.

3. Delete the contents of the StepNavigationTemplate to avoid duplicate
buttons:

<StepNavigationTemplate></StepNavigationTemplate>

Done! The buttons work automatically with no additional code as theWizardcontroljust seems to check the CommandName on postback.

This means you can use LinkButtons or ImageButtons too in the same way
as long as the commandname is the same.

Nick...

Walter Wang [MSFT] wrote:
Hi Nick,
You can use following steps to hide or show each step'snext/prevbutton:
1) Add following CSS rules to your ASPX:
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.hidden { display: none; }
.visible { display: inline; }
</style>
</head>
You can find more information about CSS display here:
#CSS2 - The display declaration
http://www.quirksmode.org/css/display.html
2) Handle theWizard'sActiveStepChanged event:
protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 1)
{
Wizard1.StepNextButtonStyle.CssClass = "hidden";
}
else
{
Wizard1.StepPreviousButtonStyle.CssClass = "visible";
Wizard1.StepNextButtonStyle.CssClass = "visible";
}
}
Hope this helps.
Sincerely,
Walter Wang (waw...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ps/default.asp...
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
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.- Hide quoted text -- Show quoted text -
Jan 24 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.