A note from Mark Miller
: Laura Rogers is leading a live online workshop this Friday: Getting Started with the Data View Web Part
. This article is a warm up to that presentation.
When a Data View Web Part is added to a page in SharePoint Designer, it is sometimes useful to include links to the content of the list. In a regular view of a list on your site in the browser, the list's Title field is a link to open the item. In a data view web part, this functionality is not automatically included. Following is a step-by-step process for using SharePoint Designer to add a hyperlink to a field in a Data View Web Part.
I've already added the document library to the page as a data view web part.
Notice that all of the names of the documents are just plain text. We want each of these to be a hyperlink to open that document. Here's how to accomplish that:
- Click to select the name of one of the documents in the "Name" column. Click the little chevron button next to the field.
- Notice that the field is formatted as "Text". Click the drop-down box to change this format to "Hyperlink". Click <Yes> to the message.
- On the "Edit Hyperlink" screen, clear out the Address field at the bottom. You'll notice that this automatically clears out the "Text to Display" field at the same time.
- Click the Function button to the right of the Address box. This screen lets us pick which field should be used for the hyperlink's address.
- Click on the URL Path field, and click <OK>
- Clear out the "Text to Display" box at the top, and click the function button next to the box. Pick the "Name (for use in forms)" field, and click <OK>
- The Edit Hyperlink screen now looks like this. Click <OK>
- Now, when you save the page, and hit the F12 key to preview this page in the browser, each document's name will have a link to open that document.
For a LIST, as opposed to a library, the only difference is what is entered in the Address box on the Edit Hyperlink screen. Here's how to configure the link to a list item:
- Clear out the Address box, and type a backslash. /
- Click the function button to the right of the box, choose the Path field, and click OK.
- Type the following after the field you just inserted:
- Click the function button again to pick a field. Select the ID field and click OK.
- In the Text to Display box, don't forget to use the function key to pick which field you would like displayed. I'll pick the Title field in this example. Here's the result:
- Click <OK>. Save the page and preview it in the browser to see how it works.
Now, whether you're working with a library or a list, you can confidently create hyperlink fields.
If you found this helpful, I'd like to see you at my live online workshop this Friday: Getting Started with the Data View Web Part