Save Button Redirect URL with Parameter RRS feed

  • Question

  • I have a save button and I added a Redirect URL which works fine on the Create pages as I don't have an ID so I just send user back to the home page like this:

    <SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2" RedirectUrl="/sites/MySite"/>

    On the edit form I'd like to send the user to a View page where they can view their changes (Ultimately I'd like that on Save as well but don't have an ID so if that is possible BONUS). I've tried setting it up like this but it leaves the ID blank:

    <SharePoint:SaveButton runat="server" ControlMode="Edit" id="savebutton2" RedirectUrl="/sites/MySite/SitePages/View.aspx?id={@ListItemId}"/>

    Any ideas how I can include the parameter there? It is a querystring param if that makes a difference. I've also tried the <xsl:value-of select="@ID"/> but that just threw an error all together. And {@ID} leaves the value blank as well.

    • Edited by nighthawk75 Thursday, October 17, 2019 5:24 PM
    Thursday, October 17, 2019 5:23 PM


  • Ah! I found some helpful information finally - but not here so I will share the solution I found. 

    Directly after the xsl:stylesheet declaration I added:

    <xsl:param name="ListItemId"></xsl:param>

    Then for my redirects I used:

    <SharePoint:SaveButton runat="server" ControlMode="Edit" id="savebutton2" RedirectUrl="/sites/MySite/SitePages/View.aspx?id={$ListItemId}"/>

    And Volia! Redirection to custom view form!

    • Marked as answer by nighthawk75 Thursday, October 17, 2019 5:55 PM
    Thursday, October 17, 2019 5:55 PM