Dynamically changing SharePoint 2010 list form rendering templates

fix

Saturday, March 6th, 2010

Here is the scenario: you have few lists in your portal that`s already deployed in production environment and contain data. Here you realize that you need to adjust one of the lists` rendering template to remove some information on a Displayor Edit form.  You can`t change the schema.xml of the list because you will have to recreate the it and your customer will loose all the data.

Assuming you already have a rendering template ready or have just deplo0yed it – here is one quick way to rescue the day:

1. Open site in SharePoint Designer.

2. Click Lists and Libraries.

3. Click on the list you`d like to change the template on (Comments in my example)

attachment.ashx

4. Select the View of your interest, in my case I`ll be changing Display Form (ViewComments.aspx in case of Comments list)

attachment.ashx (1)

5. The designer will load the view. Make sure you pick a split view to see visual and code of the form.

attachment.ashx (2)

6. Click on the form as shown below, that way SharePoint Designer will show the piece of code representing the display form webpart.

attachment.ashx (3)

7. In the “code” window find TemplateName in the highlighted section and find the “ListForm” property in that section and replace it with the rendering template that you have provisioned to the site.

That`s it, when done, just save the form and refresh the actual form page in your browser – the new form will be picked up right away.

attachment.ashx (4)

Good luck!

news

Any information posted on this blog does not reflect views of respective product vendors unless explicitely stated.

featured