Partner links

asp.net wizard control sidebar template customization




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");
}
}
}
http://cdn.are.ehibou.com/wp-content/plugins/downloads-manager/img/icons/default.gif download: WizardWithCustomSideBar.zip (16.67KB)
added: 28/07/2010
clicks: 228
description: Wizard With Custom Side Bar

7 comments to asp.net wizard control sidebar template customization

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>