“The parameters dictionary contains a null entry for parameter” – How to fix?

That empty string for productId (in your default route) will get parsed to a null entry by the Framework, and since int does not allow null…you’re getting the error.

Change:

public ViewResult Edit(int productId)

to

public ViewResult Edit(int? productId)

if you want to allow for the caller to not have to pass in a product id, which is what it looks like what you want to do based on the way your route is configured.

You could also re-configure your default route to pass in some known default for when no productId is supplied:

routes.MapRoute( 
    "Admin", 
    "Admin/{action}/{ productId}", 
    new { controller = "Admin", action = "Edit",  productId= -1 } 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)