ASP.NET MVC - passing parameters to the controller

后端 未结 10 1323
小蘑菇
小蘑菇 2020-11-28 23:36

I have a controller with an action method as follows:

public class InventoryController : Controller
{
    public ActionResult ViewStockNext(int firstItem)
           


        
10条回答
  •  醉酒成梦
    2020-11-29 00:03

    Or, you could try changing the parameter type to string, then convert the string to an integer in the method. I am new to MVC, but I believe you need nullable objects in your parameter list, how else will the controller indicate that no such parameter was provided? So...

    public ActionResult ViewNextItem(string id)...
    

提交回复
热议问题