Question: How to change sidebar template of the wizard control so that only previous wizard steps would be enabled?
Answer:Create something like this in your *.aspx file:
<asp:Wizard ID="Wizard1" runat="server"> <WizardSteps> <asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1"> </asp:WizardStep> <asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2"> </asp:WizardStep> </WizardSteps> <SideBarTemplate> <asp:DataList runat="server" ID="SideBarList" OnItemDataBound="SideBarList_ItemDataBound"> <ItemTemplate> <asp:LinkButton runat="server" ID="SideBarButton" Font-Bold="true" /> </ItemTemplate> </asp:DataList> </SideBarTemplate> </asp:Wizard>
And create something like this in your *.aspx.cs file:
protected void SideBarList_ItemDataBound(object sender, DataListItemEventArgs e)
{
WizardStep dataItem = e.Item.DataItem as WizardStep;
LinkButton linkButton = e.Item.FindControl("SideBarButton") as LinkButton;
if (dataItem != null)
{
//If active step index less than item index lets disable the link
if (dataItem.Wizard.ActiveStepIndex < e.Item.ItemIndex)
{
linkButton.Enabled = false;
}
//If active step index equals to item index lets remove underline
if (dataItem.Wizard.ActiveStepIndex == e.Item.ItemIndex)
{
linkButton.Style.Add(HtmlTextWriterStyle.TextDecoration, "none");
}
}
}
|
|
download: WizardWithCustomSideBar.zip (16.67KB) added: 28/07/2010 clicks: 228 description: Wizard With Custom Side Bar |

how to change the positon of control in visual studio 2008?
Hi,
This code is helped me.
Thanks
This was a huge help.
Thank you
Thanks. this is great help, for this i was struggling for a long time….
Dude, this is awesome! nice!
Outstanding, dude!
Thank you so much for your article dude, i’ve been working for over a week on this. I needed to hide a wizard step. Thanks again.