Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

RedirectToAction with parameter

$
0
0

Hi,

I use asp net core mvc (2.0)

I have two controller with the corresponding views. In controller1/Details/xx i made a link to controller2/Edit This works without problems.

In View controller2/Edit there is the form field "Produkt". This value corresponds to "xx" from controller1/Details/xx

In controller2/Edit I have the following Code:  

public async Task<IActionResult> Edit(int id, [Bind("Id,Produkt,aa,aa,aa")] Controller2 Controller2)


When I press the "Save" button in view controller2/Edit, I come to controller2/Index.

But I want come back to controller1/Details/xx

So I changed the RedirectToAction in controller2.Edit to:

return RedirectToAction("Details", "controller1", new { id = 2 });

Principle this works, but only with the fixed value "2"

Is it possible to Read the value from "Produkt" and but it in the RedirectToAction?

Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>