The SharePoint SaveButton RedirectURL attribute does nothing. What for?

I have a SaveButton SharePoint in my EditFormTemplate, and I do not want the browser to redirect the default location, which is a list view (i.e. AllItems.aspx). Instead, I want the user to be redirected to another page.

Many other people have the same problem. I don’t want to replace SharePoint SaveButton with a standard aspx button control and use JavaScript, as this presents its own set of problems, and frankly, I don’t think that such functionality deserves hacking JavaScript.

If the "RedirectURL" attribute really exists for SharePoint SaveButton (what it does), then why on Earth didn’t it just redirect the browser to the specified URL?

<SharePoint:SaveButton ID="SaveButton1" runat="server" RedirectUrl="[My Custom URL]" />

Why doesn't the code do what I want to do?

+4
source share
3 answers

You need to use the ddwrt: GenFireServerEvent JavaScript call ('_ redirect = {URL}'. Take a look at the example below:

<input type="button" class="contact-button" value="Save" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={example.aspx}')}" />

Hope this helps.

+1
source

OK I get it.

I created an SPListItemEventReceiver and set the ItemUpdated Synchronization element in Elements.xml to Synchronous .

<Synchronization>Synchronous</Synchronization>

, .

, , async update async, ItemAdded ItemAdding.

HttpContext, currentContext, , currentContext HttpContext.Current, SPUtility.Redirect ItemUpdated , , currentContext, .

0

I had problems with SaveButton if the URL of the form in which it is used includes the Source parameter . I don’t remember the details, but my fix was simply not to enable this option when opening the form.

It seems like another problem for you, but it might help someone.

Dave

0
source

Source: https://habr.com/ru/post/1533569/


All Articles