c# - The parameters dictionary contains a null entry for parameter 'testId' of non-nullable type 'System.Int32' -
i'm trying call action in controller:
using url: http://localhost:5345/managetest/details/5
[authorize] public class managetestcontroller : controller { public actionresult details(int testid) {
the parameters dictionary contains null entry parameter 'testid' of non-nullable type 'system.int32' method 'system.web.mvc.actionresult details(int32)' in 'mamadmin.controllers.managetestcontroller'. optional parameter must reference type, nullable type, or declared optional parameter. parameter name: parameters
that looks you're trying map default route, is:
routetable.routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional });
to that, change parameter name in actionresult
id
:
public actionresult details(int id)
otherwise you'd have use url:
http://localhost:5345/managetest/details?testid=5
Comments
Post a Comment