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

ASP.NET MVC Version History

Auto Refresh .aspx page - ASP.NET

Page Life Cycle in ASP.NET

Introduction to ASP.Net MVC

How to Update Dependent Excel Cells Automatically

MVC Request Execution Stages - Life Cycle

Differences between a Structure and Class

AdRotator control in ASP.Net