MVC3 Html.ActionLink帖子 [英] MVC3 Html.ActionLink Post

查看:185
本文介绍了MVC3 Html.ActionLink帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC3 C#.NET Web应用程序,并需要调用使用Html.ActionLink视图。我无法从文档告诉我是否可以指定POST或GET。下面是我的HTML,是否有指定的方式GET或POST?

  @ Html.ActionLink(新建,编辑,子任务,
                        新{ID = ViewBag.Id,命令=CreateHourEntry},NULL)


解决方案

如果你想使用后,但Ajax.ActionLink意识到这是一个Ajax职位。您可以轻松地使用jQuery使你的现有链接导致一种形式后,但此功能不包括在Html.ActionLink。

请参阅
ASP.NET MVC的ActionLink和POST方法

I have an MVC3 C#.NET web app and need to call a view using Html.ActionLink. I can't tell from the documentation if I can specify the POST or GET. Below is my HTML, is there a way to specify GET or POST?

 @Html.ActionLink("Create New", "Edit", "Subtask", 
                        new {Id = ViewBag.Id, Command="CreateHourEntry"}, null)

解决方案

If you want a post use Ajax.ActionLink but be aware it's an Ajax post. You could easily use jquery to cause your existing link to cause a form post but this functionality is not included in Html.ActionLink.

See ASP.NET MVC ActionLink and post method

这篇关于MVC3 Html.ActionLink帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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