From: http://www.endusersharepoint.com/?p=1641

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.

DVWP Links

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:

  1.  Click to select the name of one of the documents in the 「Name」 column.  Click the little chevron button next to the field.

     

    DVWP Links
  2. Notice that the field is formatted as 「Text」.  Click the drop-down box to change this format to 「Hyperlink」.  Click <Yes> to the message.

     

    DVWP Links
  3. 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.
  4. 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. 

     

    DVWP Links
  5. Click on the URL Path field, and click <OK>
  6. 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>
  7. The Edit Hyperlink screen now looks like this.  Click <OK>

     

    DVWP Links
  8. 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:

  1. Clear out the Address box, and type a backslash. /
  2. Click the function button to the right of the box, choose the Path field, and click OK. 
  3. Type the following after the field you just inserted:
    /Dispform.axpx?ID=
  4. Click the function button again to pick a field.  Select the ID field and click OK.
  5. 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:

     

    DVWP Links
  6. 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.


arrow
arrow
    全站熱搜

    YoYo 發表在 痞客邦 留言(1) 人氣()