Customise List View page

See previous post for basic steps regarding setting up a DataView.

Open SharePoint Designer (SPD) and edit the dispForm.aspx page of your list. Set up a DataView object on this page that joins your lists, as seen in the previous post.dataviews2_1.jpg

You can modify the layout and text of the Dataview through the ‘Design’ view in SPD, however for more advanced customisations open the ‘Code’ view and start hacking the XSL! Inside the DataFormWebPart (DataView that SPD creates) there is an <XSL > tag where you can modify the html around the data elements, or change the data elements/parameters etc yourself. Read the rest of this entry »

Using XSL to render SharePoint webparts

Certain SharePoint web parts such as the Content by Query web part, Table of Contents web part, and the Summary Links web part have a property that allows you to select the XSL stylesheet that controls the HTML output of the webpart.

This allows us to override the default Microsoft html layout for each of the webparts. Which is fantastic as much of the default html output of web parts is rubbish html code, horrible for accessibility, and also full of sizable and unnecessary html.

For example a html list, such as the Summary Links web part, you would expect to be rendered in a <ul> <li> list tags, but by Microsoft default is rendered as nested tables. Not good…

By default, you can select the type of Item Style you want from the web part properties in the ‘Modify Web Part’ menu option, giving you a list of styles to choose from. The list of these styles corresponds to the xsl templates in the XSL stylesheet.contentqueryxsl1.jpg

So… how to change this or add your own style? Read the rest of this entry »

Replace GUID with List Name in a SharePoint DataView

Recently I was experimenting with DataViews using SharePoint Designer (SPD). Basically the SPD  interface allows you to joins two lists so you can produce a view with merged data, kind of like what you would do with a SQL JOIN query.

Well it works fine for basic queries on a live site, but there are drawbacks for planned development, such as it uses GUIDs of lists rather than a name of the list. As lists have different GUIDs across environments (even if you create a feature/code etc to deploy lists) the DataView will not deploy properly across environments as the GUID will be different.

This can be easily overcome if you open the code view of the SPD page to the Query section. The list ID will be the default GUID of the lists, just change the ListName property of the SPDataView to the Name of the list! Read the rest of this entry »