This time it’s not a walkthrough. Only a description of what you have to do. – It’s “experimental”!!!
The need is to deploy a conditional formatting in a list definition that was created in a SharePoint 2010 Visual Studio (2010) project.
1. You need to design the list definition. Create a list instance for the list definition. This instance you can remove later if you want.
2. Deploy the project. It’s without conditional formatting at this point.
3. Create the conditional formatting in SharePoint Designer.
Open the list instance.
Open the list view you want to modify.
Select the cells that should have a conditional formatting.
Create the conditional formatting.
4. Open the “Code” view of the list view page.
5. Look for the “<xsl>” tag of the XsltListViewWebPart that renders the list data.
Copy the content of the <xsl> tag.
6. In Visual Studio open the “Schema.xml” file of the list definition.
7. In the <views> tag look for the view you want to modify. E.g. “AllItems.aspx”. Look for the “Url” attribute of the view tag that contains the Web Part Page name (e.g. “AllItems.aspx”).
8. Before the closing “view” tag add this:
<Xsl> <![CDATA[ ... ]]> </Xsl>
Replace the “…” through the copied content of the web part pages “xsl” tag content.
9. Deploy the project.
10. It’s done! – BUT: You may be unable to edit the conditional formatting in SharePoint Designer! As I said: It’s experimental.
Hi,
that is a great post which worked for me fine. Thank you for sharing your thoughts. I created a small step by step how to http://www.ilikesharepoint.de/2012/03/sharepoint-2010-conditional-formatting-for-lists-using-visual-studio/
Regards
Karsten
Hi Karsten! – Thank you for your comment and for the validation of the nessessary steps…! kind regards, ingo