Quick theming your asp.net website

Diya0076
Posted by in ASP.NET category on for Beginner level | Views : 5844 red flag

In this article you will learn how you can quickly apply themes in you asp.net project


 Download source code for Quick theming your asp.net website

Introduction

Hello friends, 

As you know themes is one of the interesting features of asp.net. It makes the webpage attractive.

As explained in MSDN, A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in a Web application, across an entire Web application, or across all Web applications on a server. 

Before reading this article i suggest you to first learn what are themes are how we can create themes because in this article i have show how quickly you can create themes.

 

Themes are usually used in social networking websites because it allow users to set their own theme for their account

 

Usually we create themes by adding themes in our project set their colors, backgrounds etc. 

It takes time when we want to create the website quickly and themes are necessary to add.

 

But how to create them quickly ?

 

There is one site http://www.pyzam.com/ it provides lots of themes which we can use in our asp.net website.

 

There you can find themes on different fields like cartoon, season, celebs etc.. 


Just copy the code to the WordPad that is provided from that website.

 

Now you have to set that code properly.


·         Background Image/Background Color

 

The main thing of the webpage is background color or background image that’s why first you have to download the image of background and save it to your project that is provided by the pyzam’s code.

·         Asp.net Controls

For asp.net controls you can do setting in the skin file.

For data controls like data list, details view etc you have to select color based on the theme particular theme


·         Buttons

 

For buttons, you can select any background color, download buttons from the website or you can or you can create your own choice of button using Photoshop.

You can add css classes if required for the elements like table, h1 etc.

 

In my example I have created three themes using the pyzam.com, those are kitty, fairy and flower.

 

In the example there are 2 main files. First which is showing the themes and second where you can apply themes

In theme.aspx you will find the list of themes that you can apply


Based on selected theme will be applied and page will be redirected to defual.aspx. Suppose if you have select fairy,

themes.aspx.cs

clicked on fairy theme button

protected void ImageButton8_Click(object sender, ImageClickEventArgs e)
    {
        Session["theme"] = "Fairy";
        Response.Redirect("~/Default.aspx");
    }

 


Defual.aspx.cs:

 

protected void Page_PreInit(object sender, EventArgs e)
    {
        if (Session["theme"] != null)
        {

            Page.Theme = Session["theme"].ToString();
        }
        else
        {
            Page.Theme = "Blue";
        }

    }

Same way you can create your own favorite theme quickly and make you website attractive.

 

Page copy protected against web site content infringement by Copyscape

About the Author

Diya0076
Full Name: diya ahuja
Member Level: Starter
Member Status: Member
Member Since: 4/28/2010 7:08:51 AM
Country: India

http://www.dotnetfunda.com
D. Ahuja

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)