首页 新闻 赞助 找找看

mvc跳转参数的写法 没什么豆路过的大侠看看吧 谢谢!

0
悬赏园豆:5 [已解决问题] 解决于 2012-08-30 17:56

public ActionResult frmLogin() { return RedirectToAction("Index", " WC_Index"); }

 

对应的控制器WC_Index Index方法

        public ActionResult Index(string name, int? ObjectID = 1)
        {
          xxxxx
        }

这个跳转的方法的参数是这样写对吗?

return RedirectToAction("Index", " WC_Index",“null”);
s_p的主页 s_p | 初学一级 | 园豆:138
提问于:2012-08-29 18:14
< >
分享
最佳答案
0

RedirectToAction("Index","WC_Index",new { ObjectID = 1})
没有参数时
RedirectToAction("Index","WC_Index”)

收获园豆:4
Jeremy Liu | 小虾三级 |园豆:705 | 2012-08-29 18:30

return RedirectToAction("Index", " WC_Index", new { name = "", ObjectID = 1 }); 没有用啊 朋友

s_p | 园豆:138 (初学一级) | 2012-08-30 10:01

@s_p: ok了不小心写了空格

s_p | 园豆:138 (初学一级) | 2012-08-30 17:55
其他回答(1)
0
1 //使用操作名称和控制器名称重定向到指定的操作。
2 RedirectToAction(String, String)

直接:

1 return RedirectToAction("Index", " WC_Index");

是不行滴....

希望大家多多交流:hongtenzone@foxmail.com

收获园豆:1
Hongten | 园豆:1768 (小虾三级) | 2012-08-29 18:34

我知道不行啊 那个方法有参数

支持(0) 反对(0) s_p | 园豆:138 (初学一级) | 2012-08-30 10:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册