Last post Nov 15, 2007 01:40 AM by rakeshkmbj
Nov 28, 2006 06:42 AM|svijai|LINK
hai this is vijai.
how to make themes and sking in asp.net2.0, and how to add them in a webpage.
will please send me the code.
Asp.Net 2.0 session
Nov 28, 2006 08:49 AM|surfer5|LINK
There are a couple of steps in creating a Theme, and not much of it is actually "code".
To actually create the theme, go into your project and right-mouse click on your project in the solution explorer. On the drop-down menu that appears, select "Add ASP.NET Folder" and then "Theme". A new folder called "App_Themes" will be created with a
subdirectory temporarily named "Theme1" (you can just type over the name that is there to name the folder whatever you want it to be -- this will be the name of your theme). For the rest of this response, we will assume you called the folder "Default", indicating
this is the theme named "Default".
You have just created a theme. One that doesn't do anything, but a theme none the less.
To prove that, go into the page directive of any page (or Master Page). Add the property "Theme" and type an equals sign. As soon as you do, you will see your Theme appear in the Intellisense. Select your theme. Your theme is now applied to that page.
Again, you have just applied a theme that doesn't actually DO anything, but you have now created a theme and applied it to a page in ASP.NET 2.0.
To make it do something, you need to create a SKIN file. Go back to your Solution Explorer and right-mouse click on the Theme folder ("Default") and select "Add New Item". This will give you a screen that allows you to select what you want to add. With
a theme, there are limited selections. Click on the option for "Skin File", give it a name, and press "Add".
When you do this, you will see a new SKIN file has been added to your theme and it will be opened for you. At the top of the file is a bunch of commented out examples of how to populate the file. Basically, you just put in all of the formatting options
for a particular ASP.NET control (e.g., Height, Width, CssClass, etc) that you want to be universally true for all controls adopting this theme.
As a suggestion, what I like to do is generate a scratch page that I use to create the formatting for the control. For example, I would drop a gridview on the scratch page and then size it and apply color/style formatting and anything else that I think
will be needed for all other gridviews in my project. Then I take that code and drop it into the SKIN file, removing the ID field because that will cause you an error. I do this for a couple of reasons. For one, there is no preview in the SKIN file so you
can't see what you are doing. For another, Intellisense, by default, is not turned on in SKIN files. I found a workaround for that but, if you use the scratch page idea, you don't need it.
It should also be noted that putting CSS files in the theme automatically applies them to the page that adopts the theme. Just adding the CSS file to the theme is all you have to do (you don't have to make references to the CSS files anywhere in code).
The theme will automatically apply all CSS files it finds in the theme.
Hopefully that will help you get started.
Nov 15, 2007 01:40 AM|rakeshkmbj|LINK
Select a theme of the page：