Wednesday, April 7, 2010

Customize List Form Tool bar buttons in Sharepoint...

Ever wondered how to customize Toolbar buttons in list/task forms at site collection level? Life is easy if you know basic sharepoint folder structure!

Here is what you do
1. Go to ControlTemplates under 12 hive folder [C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES]
2. Now create new ascx file under that folder [right click and create txt document then rename it to CustomToolBar.ascx]
3. Now locate "DefaultTemplates.ascx" file under same folder and search for following

4. Copy entire tag
<sharepoint:renderingtemplate id="ListForm" runat="server"> ........ All the text until......</sharepoint:renderingtemplate>

5. Now open the ascx file you created in step 2and paste the code you copied from "defaultTemplates.ascx" in step 4.

6. Now locate "sharepoint:savebutton" in your file. Now you can customize it for example: add Text="Save" so button Text changed from "Ok" to "Save" !!!

you can do the same for sharepoint:gobackbutton

[NEVER MODIFY DefaultTemplates.ascx FILE. CREATE YOUR OWN FILE, SHAREPOINT USES YOUR FILE TO OVERRIDE DEFAULTEMPLATES.ASCX FILE]

7.Also, don't forget to add <assembly> and <page> directives to your custom file from DefaultTemplates.ascx file.

8.Now, You MUST restart IIS to see your changes... [u can use iisreset /noforce from command prompt to restart your IIS]

Enjoy...............

In my next blog..i will show you how to add custom
and handle "click" event for it [something like "Save As Draft" !!!]

No comments:

Post a Comment