Link to home
Create AccountLog in
Avatar of rgagli1
rgagli1

asked on

ASP.Net Wizard - Hide titles in the sidebar and don't allow a user to click ahead (for nonlinear)

I have a few steps in my Wizard that are skipped and I don't want to show those in the sidebar.  Can I hide these steps that are skipped?  Also, can I disallow a user to skip ahead in the step sequence or maybe not even click on the hyperlinks at all?

Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

I've only used the wizard control once.  When I did, I was unable to hide any navigation links.  I was able to disable a link in certain scenarios, so it would just skip past it.

To do that, in the wizard's ActiveStepChanged event I added some code that set the AllowReturn property of the link in question.
If SkipStepFour() Then 'boolean function that checks if you should skip the step'
    Wizard1.WizardSteps(3).AllowReturn = False '0-based index 3 is the 4th step'
    If Wizard1.ActiveStepIndex = 3 Then Wizard1.ActiveStepIndex = 4
Else
    Wizard1.WizardSteps(3).AllowReturn = True
End If

Open in new window

Avatar of rgagli1
rgagli1

ASKER

Is there a way to show the links but not allow a user to click on them so that they have to navigate with the previous and next buttons?
You can hide all the links or show all the links.  If you show the links, they will be clickable.  But remember, I've only used the control once, so there's probably a lot more to it than I had time to learn.

You could always just hard-code the steps into the html if you want.
Oh yeah:  If push comes to shove, you can always write a control adapter to make the control behave exactly the way you want, but that's likely to be more trouble than it's worth.
Avatar of rgagli1

ASKER

Do you know where I can find information about adaptors?
Avatar of rgagli1

ASKER

Here is something in C# but I'm in VB.  

http://www.codeproject.com/KB/aspnet/CustomizingWizardNav.aspx
You should be able to download that code, include it in it's own project and add a reference to that project in your web site-- no C# specific knowledge required.  It's also a good idea to get at least a passing acquaintance with C#, and it's not as hard as it seems since they both share the same base class library.

That said, it's probably better to stick with the stock control unless you absolutely have to change it.  My advice is to just include something like an "(optional)" text or asterisk next to the step name for in the side bar, or indent it so it looks like sub step of the one previous.  Those are possible within the limits of the control out of the box.
Avatar of rgagli1

ASKER

Also I found if you add OnClientClick="return false" to itemtemplate, inside the sidebartempalte.  The user can click the items but it doesn't move forward or backwards.

Thanks
Avatar of rgagli1

ASKER

Is there a special way to add spaces to the titles?  When I added them it didn't show up with spaces
ASKER CERTIFIED SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account