[Resolved] Nicer way to redirect from plugin to admin page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 anni tempo fa
Hi,

I have a plugin which has a tab page in the Admin/Order/Edit page by adding the tab programmatically. I can not do an update of data there, since the form post will go to the Order controller instead of to my plugin controller. I therefor have added a link with <a href=mypluginurl> [bit nasty, suggestions welcome]. Once I finish there, I want to redirect back to my admin/order/edit. I now have:

return Redirect(string.Format("/Admin/Order/Edit/{0}", orderId));    

Is there a nicer way with RedirectResult or by using the controllers and action names?

If you have a suggestion for the 'trip outside the admin with a href that would be great too.

J.
9 anni tempo fa
Did you try ?

 return RedirectToAction("Edit", "Order",  new { id= orderId });
9 anni tempo fa
Yes, but that does not give the Admin/Order/Edit since it is called from a plugin and not from within Admininistration.
9 anni tempo fa
try this

return RedirectToAction("Edit", "Order",  new { id= orderId, Area="Admin"});
9 anni tempo fa
try this

return RedirectToAction("Edit", "Order",  new { id= orderId, Area="Admin"});
9 anni tempo fa
Thank you. That did the trick.
7 anni tempo fa
I know this is really old, but I also have a plugin that adds a tab on the "edit" "order" section, and when I hit "save" inside my new tab it does nothing. I mean it does do the updates I want, but it never leaves the page. I'd like it to say "successful" or some success message. I have this at the end:

return RedirectToAction("Edit", "Order", new { id = orderId, Area = "Admin" });
6 anni tempo fa
dootchie wrote:
I know this is really old, but I also have a plugin that adds a tab on the "edit" "order" section, and when I hit "save" inside my new tab it does nothing. I mean it does do the updates I want, but it never leaves the page. I'd like it to say "successful" or some success message. I have this at the end:

return RedirectToAction("Edit", "Order", new { id = orderId, Area = "Admin" });



You can always do a success message by adding this in before your redirect

success:

SuccessNotification("Order successful.");


error:

ErrorNotification("Order error.");
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.