The parameters dictionary contains a null entry for parameter 'productId' of non-nullable type 'Syst
Posted
by Naim
on Stack Overflow
See other posts from Stack Overflow
or by Naim
Published on 2010-03-23T13:00:37Z
Indexed on
2010/03/23
13:03 UTC
Read the original article
Hit count: 762
Hi Guys,
I am trying to implement an edit page in order administrator to modify data in database.Unfortunately I am encountering an error.
The code below:
public ViewResult Edit(int productId) { // Do something here }
but I am getting this error:
"The parameters dictionary contains a null entry for parameter 'productId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ViewResult Edit(Int32)' in 'WebUI.Controllers.AdminController'. To make a parameter optional its type should be either a reference type or a Nullable type.
Parameter name: parameters"
I changed my route in Global.asax.cs like this:
routes.MapRoute(
"Admin",
"Admin/{action}/{ productId}",
new { controller = "Admin", action = "Edit", productId= "" }
);
but still I am getting the error
Thanks for your help!
Naim
© Stack Overflow or respective owner