asp.net MVC 4控制器中的多个参数

时间:2022-05-12 16:47:28

I'm using VS2010 and ASP.NET MVC 4 for my project. I need a controller that should get 2 parameters.

我正在为我的项目使用VS2010和ASP.NET MVC 4。我需要一个应该获得2个参数的控制器。

this is my controller method:

这是我的控制器方法:

[AcceptVerbs(HttpVerbs.Get)]
public ActionResult AcceptBid(int? Id, int? Accept)
{
    if (Id != null && Accept != null)
    {
          //my code...
    }
}

and I created action link like this:

我创建了这样的动作链接:

@Html.ActionLink("Accept", "AccpetBid", "Project", new { area = "Service", Id = item.ProjectId, Accept = item.Id }, null)

When I clicked on this link, controller not working and this error thrown:

当我点击此链接时,控制器无法正常工作并抛出此错误:

Server Error in '/' Application.

'/'应用程序中的服务器错误。

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.

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

Note that other controller methods in this controller class are working.

请注意,此控制器类中的其他控制器方法正在运行。

1 个解决方案

#1


1  

The action name is 'AcceptBid' but your link are trying to access 'AccpetBid'.

操作名称为“AcceptBid”,但您的链接正在尝试访问“AccpetBid”。

#1


1  

The action name is 'AcceptBid' but your link are trying to access 'AccpetBid'.

操作名称为“AcceptBid”,但您的链接正在尝试访问“AccpetBid”。