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

Page Life Cycle in ASP.NET

Send Email using Gmail SMTP server - ASP.NET

MVC Request Execution Stages - Life Cycle

Abstract Class and An Interface

Introduction to ASP.Net MVC

Auto Refresh .aspx page - ASP.NET

Auto Sequence Number in Grid Control with Paging

Variable Value in Top Statement

ASP.NET MVC Version History