Data View Web Part, The Basics – Add a Hyperlink
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.
Solution Overview
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.
Document library:
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:
/Dispform.axpx?ID= - 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.
Author: Laura Rogers, Birmingham, AL
Laura Rogers is a SharePoint Administrator at HealthSouth Corporation in Birmingham, Alabama. She has ten years of experience with Microsoft’s messaging and collaboration systems, including four years in SharePoint implementation, training, and customization.
Laura has been a MCSE since 1999, with her most recent certifications being MCSE 2003 + Messaging, MCTS in MOSS and MCTS in WSS 3.0 Configuration. She also wrote a chapter in the Microsoft Office SharePoint Server 2007 Administrator’s Companion by Bill English.
- New Article Series: Laura Rogers on Data View Web Part Basics
- Data View Web Part, The Basics - Insert a DVWP on Your Page
- 6 Minute Screencast: Insert a Data View Web Part onto a SharePoint Page
- Data View Web Part, The Basics - Folders
- 3 Minute Screencast: Use DVWP to display all files, even those stored in folders!
- Data View Web Part, The Basics - Add a Hyperlink
- Data View Web Part, The Basics - Keep it Clean
- Data View Web Part, The Basics – Multiple Edit Forms
- 3 Minute Screencast: Data View Web Part, The Basics – Multiple Edit Forms
- Live Online Workshop - Data View Web Part Solutions: Part 2
- 5 Minute Screencast: SharePoint Web Services for Non-Developers
- 3 Minute Screencast: Merging SharePoint Document Libraries
- 2 Minute Screencast: Permissions Dashboard
- 4 Minute Screencast: Join View of SharePoint Lists
- Get it Together: Groups and Totals in the Data View Web Part (Screencast)
- SharePoint: Open Links in a New Browser Window (Screencast)
- How to Create a SharePoint Data View Web Part “Rollup” (Screencast)
- SharePoint: "New" Icon (Screencast)
- Display a SharePoint List on Another Site (Screencast)
- Customize the "no items" Display Text in SharePoint (Screencast)
- SharePoint: Displaying Calculated Column SUMS in a View (Screencast)
Thanks so much for a clear solution to a frustratingly widespread issue that I’ve been trying to solve.
Quick Typo Fix: The added line in Step 3 for lists should be changed to:
/Dispform.aspx?ID=
It currently reads “.axpx”.
Great series of tutorials Laura, thanks for sharing. It has just opened up my eyes as to what can be done with the Data View Web part (I have been battling trying to get content query web parts to read document libraries with pagination).
I’m off now to learn how to really style it with xsl… Thanks from a SP n00b!
Thanks so much for these helpful tips. However, I noticed the link break when I tried to add a hyperlink to a list item inside a folder. Any help with this issue would much appreciate. Thanks again for sharing your expertise!
This is great!
Will it work for email addresses? I have a list in a DVWP with a column of email addresses.
I displayed them as hyperlinks, which appears to format correctly (”link-style”) in the data view. BUT – when a user clicks the link to send an email, it doesn’t “behave” right- they get an error page instead of an email interface.
Is this doable?
Another great, quick, and easy tip–thanks Laura.
I am using a forms library as the data source for my dataview web part. I want the form to open in a web browser as it does from the forms library. It opens in the InfoPath client from a data view web part. Is there a way to configure the data view web part to set the properties of the form to open in a web browser? Thanks
SharePoint newbie here, struggling for days to create a Title column that links to the fixed Name (document filename) column when told by my internal company expert that it can’t be done. Well, Laura, your post here has saved the day for all my process document owners and our migration to Sharepoint. Our users can now click on the Title to access a document rather than the obscure filenames we use.
Thanks,
Steve
Steve – Another way to do it is to create a calculated column that points to the file name and does an HTML href wrapper around it to create a clickable title. You’ll have to use Christophe Humbert’s TextToHTML CEWP web part, but that’s just a cut and paste job into a Content Editor Web Part. — Mark
Great article. However, I’m trying to link to the “Related Documents” (more than one) in a knowledge base without success. Any recommendations? I’m at a stopping point because of this issue.
for wich version this article apply ?
Laura,
Have you considered making an E-book of this series?
I am just learning my way around Data Web Parts and having a ready reference to go to do would be helpful. Your Articles and screencasts are very informative and helpful. It’d be nice to have ‘em bundled together.
-Robin
Really enjoying the series – very clear explanations and very relevant to real world user requests – thanks!
Laura – what modifications need to be made when using a Posts list (on a blog site)? the link ends up with extra characters – e.g., https://sitename/Lists/Posts/5_.000/Dispform.axpx?ID=5 instead of https://sitename/Lists/Posts/Dispform.axpx?ID=5 – and I can’t figure out how to get rid of the extra “/5_.000″
Actually, Laura – I just used an idea from another of your blog posts – http://sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=46 – to help me figure out a way to modify the hyperlink. In that post you discussed using “concat” to truncate a string. I ended up using {concat(’/',substring-before(@FileRef,Posts),’Posts/Post.aspx?ID=’,@ID)} (substituting “before” for “after” as you used it) and it worked perfectly! Made my day for sure… thanks!
Hi,
I was wondering how I could get the dataview web part title itself to be a link to the datasource, as oppossed to linking each individual item. Is that possible?
Thanks,
Dave
I can not tell you how insanely thankful I am that you’ve made this so easy to understand. I work in a place where the blind is leading the blind so its completely uplifting to know there are pros like you willing to share with those of us who seek liberation from our SharePoint conundrums. lol
This site is my new mecca.
Is there an updated article for adding a hyperlink in Designer 2010?
Thanks in advance,
DW
This article doesn’t work with lookup columns. The dataview column I need as hyperlink is a actually a Site lookup column. When using the {@ID} I get local list ID, not the site column ID.
So, in SPD I type ../../../List/Products/Dispform.aspx?ID={@ID} but I need something else obviously since the ID needs to be the source item ID, not local list.
Any help???
Laura, thank you for this wonderful, easy to follow post. I am using your instructions to make the list view title a hyperlink to the item and I get a ‘page not found’ message. Funny thing is that the address displayed is correct when I copy the hyperlink to a list item. It is an announcement board. Any advise you can offer would be greatly appreciated.