While working on my most recent project I came across an interesting issue with passing around QueryString values to New, Display and Edit list forms. In my scenario I have a web part which displays certain information to the user. They can then choose to drill down which takes them to another page. From here they can they link to the edit or display forms for a custom list. In order to ensure the users is always able to go backwards at any point I was keeping various parameters in the QueryString, including one for the URL for the pervious page, see below example URL’s at each stage.
Third Page(List Form)
What I was finding was when I clicked save or cancel on the edit form I was getting returned to the correct page but I was losing the SourceURL parameter hence couldn’t return the user to the first page. After some Googling around I found an article suggesting I should encode the ‘&’, ends up as %26, in the SourceURL parameter being passed to the Edit form. After changing and testing I found this worked like a treat so wanted to share for others and for my self in future. I have included the updated version of the URL’s above.