Here share with you on how to customize the Item Style in itemStyle.xsl...
Step 1 : Open SharePoint Designer and then click on “File” to “Open Site” for the portal.
Step 2 : After you have success open the portal content, a tree-view “Folder List” for the portal content will be display on left hand corner.
Step 3 : Double Click on “Style Library” > “XSL Style Sheets” > “ItemStyle.xsl”. All Item Style now listed out on your right hand corner.
Step 4 : Assume you wan to poll out Site Column “EventDate” and “EndDate” from you content.you can check internal name for the Site Column for example “Start Date” by right click property of the Site Column.
P.S. More way get to know Internal Site Column value please visit Customizing the Content Query Web Part and Custom Item Styles.
Step 5 : Sample Code to show “Event Date” and “EndDate”. Before that please ensure on the top you have already include
(xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime") in your “<xsl:stylesheet>”Step 6 : After you have finished included all code and now you can add a “Content Query Web Part” to use this item Style.
Click http://atquestdemo.blogspot.com/2009/10/practice-apply-custom-item-style-for.html to see how to use item style for Content Query Web Part.
Step 7 : Note that you would not get the output correct unless you do something on the Web Part. Therefore, you have to “Export” it and make changes through “Note Pad.exe”
Step 8 : After you have success open it look for “CommonViewFields” and start addin the “Internal Site Column” value follow by “data type”.
Step 9 : Import the edited web part back to the site and you able to view the whole style format.
Click here to see how to import Webpart!
Additional Notes
- Date Time Format Style
Reference from : Csharp-example : String Format for DateTime [C#]
- Content Type for Site Columns
Reference from : Heathersolomon : Customizing the Content Query Web Part and Custom Item Styles
No comments:
Post a Comment