MVC - Html.BeginForm(...)问题 [英] MVC - Html.BeginForm(...) question

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

问题描述

我在我的视图中有这个(管理/ FixturesAdmin ):



 ... 
@using(Html.BeginForm( FixtureList ,管理,FormMethod.Get))
{

< span class =code-keyword>< th > 灯具< / th >
< span class =code-keyword>< td > @ Html.DropDownList (Id,@ compList, - 选择comp - )/ td> < td > @ Html.DropDownList(TeamId,@ teamList, - 选择一个团队 - ) < / td >
< td > < 输入 type = 提交 value = GO / > < / td >

}





注意我试图打电话管理控制器上另一个名为 Administration / FixtureList 的ActionResult并传入 Id TeamId 参数。



我收到错误:



资源无法找到。

描述:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用。请查看以下网址并确保拼写正确。



请求的网址:/管理/ FixtureList




有没有其他方法可以做到这一点?

解决方案

好的,所以我想通了,我不得不删除 [HttpPost] 属性:doh:

我没有在我的OP中显示:doh :: doh:)

I have this in my View (Administration/FixturesAdmin):

...
@using (Html.BeginForm("FixtureList", "Administration", FormMethod.Get))
{
					 
<th>Fixtures</th>
<td>@Html.DropDownList("Id", @compList, "--select a comp--")/td><td>@Html.DropDownList("TeamId", @teamList, "--select a team--")</td>
<td><input type="submit" value="GO"/></td>

}



Note I am trying to Call another ActionResult on the Administration controller named Administration/FixtureList and passing in the Id and TeamId parameters.

I am getting the error:

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Administration/FixtureList


Is there another way to do this?

解决方案

Ok, so I figured it out, I had to remove the [HttpPost] attribute :doh:
(that i didn''t show in my OP :doh::doh:)


这篇关于MVC - Html.BeginForm(...)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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