3 回答

TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
在ASP.NET MVC框架的ControllerBase中存在一個(gè)叫做TempData的Property。
它的類型為TempDataDictionary,顧名思義是一個(gè)字典類。
TempData在ASP.NET MVC中的作用是:可用于在Action執(zhí)行過程之間傳值。
簡單的說,可以在執(zhí)行某個(gè)Action的時(shí)候,將數(shù)據(jù)存放在TempData中。
那么在下一次Action執(zhí)行過程中可以使用TempData中的數(shù)據(jù)。
如:
1 public ActionResult Index()
2 {
3 this.TempData["MyNane"] = "XiaoMing";
4 return View();
5 }
6 public ActionResult Index2()
7 {
8 string MyName=this.TempData["MyNane"] as string;
9 return View();

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超1個(gè)贊
return RedirectToAction("action","controller",RouteValue)
比如:
return RedirectToAction("action","controller",new MyModel {})
return RedirectToAction("action","controller",new {參數(shù)1=xx,參數(shù)2=xxx})

TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超6個(gè)贊
..你直接請(qǐng)求不就行了 是用ajax 傳入url、type datatype、data 傳入?yún)?shù)。和你后臺(tái)的action 里面需要傳入的參數(shù)名相同。
- 3 回答
- 0 關(guān)注
- 384 瀏覽
添加回答
舉報(bào)