Saturday, April 23, 2011

Horizontal Sidebar in ASP.NET Wizard Control

Hi All,

Below is a simple yet very powerful hack to make ASP.NET Wizard control do what it should also be able to do but isn’t. That is the “horizontal sidebar for wizard steps”.

So here are the steps:

  • Add an ASP.NET wizard control to a page or user control and add wizard steps to it as per your requirement. It will look some what like below:
Default Appearance of Wizard Control
  • Now add side bar template to this control, like I did in below code snippet.
<SideBarTemplate>
<asp:DataList runat="server" ID="SideBarList" HorizontalAlign="Justify" RepeatDirection="Horizontal">
            <ItemTemplate>
                  <div id="divWizardSampleSidebar" runat="server" class="div-WizardSample-Sidebar-Steps">
                        <asp:LinkButton runat="server" ID="SideBarButton" Enabled="true" Font-Bold="true" />
div>
ItemTemplate>
asp:DataList>
                </tr><tr>
SideBarTemplate>

  • In above code lines, everything is normal, except the last second line that is highlighted in green color. This line is the one that is creating magic. After using it, wizard will look like below:

After Using Hack
 Actually, ASP.NET wizard control renders sidebar with steps and controls in two different "td" tags under same row and here I just injected a pair of opening and closing "tr" between those to make two separate rows for steps and controls. This forced wizard control to render separate rows for both steps and contents.

Now apply some css and make your wizard look a bit more appealing.

If you have better steps to make horizontal sidebar in ASP.NET wizard control then kindly let me know.

4 comments:

  1. Thank you! This helped me very much...and such an easy fix!

    ReplyDelete
  2. This is best one article so far I have read online. I would like to appreciate you for making it very simple and easy. I have found another nice post related to this post over the internet which also explained very well. For more details you may check it by visiting this url.......

    http://mindstick.com/Articles/d2707ea4-3836-4390-ab0b-670e12e6b2dc/?Wizard%20Control%20in%20ASP.Net

    Thanks

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete

About Me

My photo
Delhi, India
Fun, music, travel and nature loving, always smiling, computer addict!!