Total Pageviews

20 April 2012

How to show hide sidebar



Default.aspx=>
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div>
        <h2 style="color: Navy; font-style: italic;">
            Wizard Example: show hide sidebar</h2>
        <asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="true" BorderColor="RosyBrown"
            BorderWidth="2" HeaderText="Sample Wizard" HeaderStyle-BackColor="PeachPuff"
            HeaderStyle-ForeColor="SaddleBrown" HeaderStyle-Font-Size="Large" Height="200"
            Width="400">
            <WizardSteps>
                <asp:WizardStep Title="First Step">
                    <asp:Label ID="Label1" runat="server" Font-Bold="false" ForeColor="PaleVioletRed"
                        Font-Size="Large" Font-Names="Comic Sans MS" Text="This is first step"> 
                    </asp:Label>
                </asp:WizardStep>
                <asp:WizardStep Title="Second Step">
                    <asp:Label ID="Label2" runat="server" Font-Bold="false" ForeColor="PaleVioletRed"
                        Font-Size="Large" Font-Names="Comic Sans MS" Text="This is second step"> 
                    </asp:Label>
                </asp:WizardStep>
            </WizardSteps>
        </asp:Wizard>
        <br />
        <asp:Button ID="Button1" runat="server" ForeColor="SteelBlue" Text="Hide Wizard SideBar"
            Height="45" OnClick="Button1_Click" Font-Bold="true" />
        <asp:Button ID="Button2" runat="server" ForeColor="SteelBlue" Text="Show Wizard SideBar"
            Height="45" OnClick="Button2_Click" Font-Bold="true" />
    </div>
</asp:Content>
Deafault.aspx.cs=>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Wizard1.DisplaySideBar = false;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Wizard1.DisplaySideBar = true;
    }
}

No comments:

Post a Comment

Contact Form

Name

Email *

Message *