Friday, November 4, 2011

How to Redirect From Custom Edit Form to Display Form Using SP Designer.


  1. Sometime it requires that after editing item of list ,it should redirect to it's display page.Using SharePoint designer we have to do liitle modification in Edit.aspx Page.
  2. To redirect Display page,we need ID of that particular Item which is already Present on Edit.aspx Page.
  3. Find out the section started with <ParameterBinding Name="ListItemId" Location="QueryString(ID)" DefaultValue="0"/>.
  4. Add below code in between <xsl:stylesheet> template. <xsl:param name="ListItemId" />      <xsl:variable name="RedirectLoc">Display.aspx?ID=<xsl:value-of   select="$ListItemId"/></xsl:variable>
  5.  Now we have to replace default SharePoint Save button with Form Action Button..
  6. Add  Form Action Button to the web part (Insert > SharePoint Controls > More SharePoint Controls).
  7. Changed  form button code to the following:
  8. <input type="button" value="Save" name="btnTopSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={',$RedirectLoc,'}'))}"/>
  9. Save custom Edit.aspx page.
  10. Test the page (changed a value, hit the custom button.  The page updated and redirected from Edit.aspx to Display.aspx and pointed to the same record).