Change SharePoint List “Display Item Form” Close Button Default Redirect Location
- 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“
Most of the times peoples are using display item form to display their list content in a page.By default SharePoint “display item form” Close button redirect you to the default view of the library where your page/document exists or default view of the list where your item exists. Some scenarios we want to change this redirect url. you can use several ways to achieve this. For an example you can use a JavaScript to achieve the same thing. In my case I’ll show you using a page parameter how we can change the Redirect page of a SharePoint “display item form” close button.In my 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 Url “http://spfoundation/_layouts/15/start.aspx#/Lists/News/DispForm.aspx?ID=1&Source=http%3A%2F%2Fspfoundation%2FLists%2FNews%2FAllItems%2Easpx” .This means after you click on Close button you will automatically redirect to “News” list default “AllItems.aspx” page.
So my goal is to change the “&Source” Parameter.
- Insert a new Display Item form
- Select your Display Item Form and click “Add/Remove Columns” button in the ribbon.this will brings the “Edit Column” window
- Remove unnecessary columns.in my example I used “Title” and “Content” Column
- Sort using “Id” to show latest Contents (this is not mandatory.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 on Parameter button.this will open the Data View Parameter Window
- Create a new Parameter called “Source” and for the “Default Value” give your redirect page url.in my example im redirect to my home page and click ok ..
- Add our new parameter at the end of your column url.in my example it’s “Title” column url.
- Save and Close Your Page. That’s it
this is how my page looks like
- This is my new Display item Form Url “http://spfoundation/Lists/News/DispForm.aspx?ID=1&Source=http://spfoundation” previously it 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
August 18, 2016 at 5:15 AM
Howdy! I’m at work browsing your blog from my new iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the excellent work!|
August 27, 2016 at 7:55 PM
Thanks Kerri
December 21, 2016 at 2:44 AM
a newbie here. can this be done without sharepoint designer?
April 8, 2017 at 3:57 PM
Hi, you have to use SharePoint designer if you’re going use this approach.
March 16, 2017 at 11:57 AM
Thank you, I’ve just been looking for information approximately this topic for a while and yours is the best I’ve discovered so far. However, what concerning the conclusion? Are you sure in regards to the supply?