Change the default Redirect Location of “Display Item Form” close button in SharePoint

Praneeth Kaushalya | November 25, 2015 at 11:12 am



Most of the time, people are using the SharePoint’s Display item form to display their list content in a page. By default, the Display item form’s close button redirect you to the default view of the library where your page/document exists or where your item exists. In some cases, some people want to change this redirect URL. We have several ways to achieve this. In this case, we can use JavaScript. I’ll demonstrate it using a page parameter on how we can change the Redirect page of Display item form’s close button. In this example I have a list called “News” and I’m going to show the latest news in a different SharePoint page called “News” which is inside the “Site Pages” library.


Currently this is my News list:


Default Display Item form:


This means after you click on Close button you will automatically redirect to “News” list default “AllItems.aspx” page. It looks like this:




So the goal is to change the “&Source” Parameter. Here’s how:


  • Create a new Page. (In my example I created a “Wiki” Page inside my “Site Pages” library. I inserted a header called “Latest News“)



  • Open the page using “SharePoint Designer




  • Insert a new Display Item form




  • Select your Display Item Form and click “Add/Remove Columns” button in the ribbon. It then opens the “Edit Column” window.




  • Remove unnecessary columns. In this example, I used “Title” and “Content” column.




  • Sort using “ID” to show latest Contents. (or you can skip this step)





  • Find <xsl:template name=”dvt_1.rowview”> tag.




  • Change the table data (<td>) content like below:




  • Select the Display Item Form and click the Parameter button. This will open the Data View Parameter window.




  • Create a new Parameter called “Source” and for the “Default Value” type in your redirect page URL. In this example, I was redirected to my home page. Click OK.




  • Add our new Parameter at the end of your column URL. In this example, it’s “Title” column URL.



  • Save and close your page. That’s it. This is how the page looks like:



This is my new Display item Form:


previously it looks like this: “http://spfoundation/_layouts/15/start.aspx#/Lists/News/DispForm.aspx?ID=1&Source=http%3A%2F%2Fspfoundation%2FLists%2FNews%2FAllItems%2Easpx




Happy Coding! Smile


For more article like this visit:


Share with