Friday, 30 March 2012

How to add style sheet for the shrepoint 2007 webpart

It is some bit confuson to provide css style sheet to the sharepoint webpart.  Because where we have place it in out project and is it acceptable by the destination point server.
First we look up the 12 hive in out sharepoint server. The stylesheets are available in the folder C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\STYLES.

yes this is the right place to keep our webpart's style sheet.  How we are going to achieve this.  No need to sweat these things are carried by wsp builder very neatly.. 

If you create a new sharepoint webpart using wspbuilder you can able to see the folder structure with many folder there you can see a foler named 12 that is really point out the 12 hive.

so our remaining work is create the folder structure as like the above mentioned  12\template\layout\styles\styles\<your webpart name>\

Then create the style sheet and refer it in your webpart.

When you are going to install your webpart in the client side it automatically added to the 12 hive and removed if you uninstall it.

Happy Coding:)
SSS.