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

Auto Refresh .aspx page - ASP.NET

Auto Sequence Number in Grid Control with Paging

MVC Request Execution Stages - Life Cycle

Overview of MVC

How to Update Dependent Excel Cells Automatically

Paged Data Source - Custom Paging

LINQ - C# Programming

ASP.NET MVC Version History

How to Edit More than 200 Rows in SQL Server 2008