ASP.Net MVC - 后从一个控制器到另一个(行动对行动) [英] ASP.Net MVC - post from one controller to another (action to action)

查看:96
本文介绍了ASP.Net MVC - 后从一个控制器到另一个(行动对行动)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时,可以从控制器产品在控制器的行动白水回收的行动保存做一个发表类别??

Is is possible to do a post from an Action "Save" in a controller "Product" to an Action "SaveAll" in a controller "Category"??

和还传递的FormCollection为参数

And also passing a FormCollection as parameter

推荐答案

您可以在您查看申报表这样,可以指定任意你想要的控制器或动作。

You can declare a form like this in your View and can specify whatever controller or Action you wish.

Html.BeginForm("SaveAll", "Category", FormMethod.Post);

如果你在一个控制器那么你可以使用。

If you are in a controller then you can use.

TempData["Model"] = Model;
RedirectToAction("SaveAll", "Category");

这篇关于ASP.Net MVC - 后从一个控制器到另一个(行动对行动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆