MVC - Html.BeginForm(...)问题 [英] MVC - Html.BeginForm(...) question
问题描述
我在我的视图中有这个(管理/ 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屋!