Applying Dynamic Themes to WebPage

Applying Dynamic Themes to Web Page (.aspx) in ASP.NET

Themes and Skins. The themes and skins features in ASP.NET 2.0 allow for easy customization of your site's look-and-feel. You can define style information in a common location called a "theme", and apply that style information globally to pages or controls in your site. Like Master Pages, this improves the maintainability of your site and avoid unnecessary duplication of code for shared styles.

protected void Page_PreInit(object sender, EventArgs e)
{
  Page.Theme = Session["Theme"] as string ?? "Theme1";
}

protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
  if (Session["Theme"] != null)
  {
      if (Session["Theme"].ToString() == "Theme1")
          Session["Theme"] = "Theme2";
      else
          Session["Theme"] = "Theme1";
  }
  else
  {
      Session["Theme"] = "Theme2";
  }
  Server.Transfer(Request.FilePath);
}


for more information related Theme & CSS class Click here

Comments

Anonymous said…
Hi,

Thank You Very Much for sharing this article here.

-- Health Tips | Health Care Tips | Alteranative Health Articles | Somnath | Jamnagar

Popular posts from this blog

MVC Request Execution Stages - Life Cycle

Page Life Cycle in ASP.NET

Abstract Class and An Interface

SOLID Principles with C#

Send Email using Gmail SMTP server - ASP.NET

Parsing the comma separated values into a temporary table

Introduction to ASP.Net MVC

Variable Value in Top Statement

How to Update Dependent Excel Cells Automatically