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"); } } }
how to change the positon of control in visual studio 2008?
Comment by satish — June 23, 2008 @ 12:29 pm
Hi,
This code is helped me.
Thanks
Comment by KK — July 3, 2008 @ 4:31 am
This was a huge help.
Thank you
Comment by Kurt Schroeder — July 17, 2008 @ 12:50 am