SharePoint - Data View Webpart - Return your customer back to your Data View

 

After your customer links to and then submits the form, they are redirected to the default list view of the SharePoint list. For most scenarios, it makes more sense to have the customer return to the Data View from which they came. In order for this to happen, the URL that you jump to must include the Source=URL name/value pair. You can make the system add this name/value pair for you automatically by adding two attributes to your link.

  1. Create or open a Data View, and then switch to Split or Code view.
  2. Go to the <xsl:template name="dvt_1.rowview"> sub-node of the <WebPartPages:DataFormWebPart> tag.
  3. Locate the <a> tag that formats the field value. For example:

<td class="ms-vb">
<a href="http://northwindtraders/Lists/Products/EditForm.aspx?ID={@ID}">
<xsl:value-of select="@Product_x0020_Name"/>
</a>
</td>


  1. Add the attributes to the <a> tag that enable the link to return the customer to this Data View. For example:

<td class="ms-vb">

<a href="http://northwindtraders/Lists/Products/EditForm.aspx?ID={@ID}"
onclick="GoToLink(this);return false;"
target="_self">
<xsl:value-of select="@Product_x0020_Name" />
</a>
</td>

Notice in the above example the onclick and target attributes added to the <a> tag.


  1. Add the Navigate to source form action to one or more buttons on the target form. For information on how to add this form action to your form, see the article Add a built-in form action to a Data View.

Comments

Popular posts from this blog

SharePoint Designer 2013 Approval Workflow with Comments

Change SharePoint server hostname and Web Application Names

SharePoint Search - Content Processing Pipeline Failed to Process the Item