Thursday, July 5, 2012

Sharepoint 2010 - Show/Hide columns with Conditional Formatting

In a previous post I describe how show/hide columns of a list with UI language, using javascript.

Now, I show how do the same using Conditional Formatting feature of Sharepoint Designer 2010.

I have same list with columns for language, DescriptionIT, DescriptionEN.

Open Sharepoint Designer 2010, and edit page with list view.

Select List and add Parameter for language taken from Cookies:

Then, select tag <TH> for List Column DescriptionIT, using selector at the bottom of page:

Now, in the Condition Formatting panel, click on Create and Apply Formatting:

In the filter clause, click on Advanced and write code as below:

Then, click OK, and Set Style, in Layout section, set Display:none:

Click OK and OK again.

Repeat steps selecting <TD> tag for values of column DescriptionIT.
Do it again for DescriptionEN column, with condition "($cookieLanguage!='1033')".

Save page and view in browser, checking columns changing UI Language.