What does this error states in asp.net-mvc?

Posted by Pandiya Chendur on Stack Overflow See other posts from Stack Overflow or by Pandiya Chendur
Published on 2010-05-01T06:24:22Z Indexed on 2010/05/01 6:27 UTC
Read the original article Hit count: 393

Filed under:
|

I have repository class in asp.net mvc which has this,

 public Material GetMaterial(int id)
    {
        return db.Materials.SingleOrDefault(m => m.Mat_id == id);
    }

And my controller has this for details action result,

ConstructionRepository consRepository = new ConstructionRepository();
public ActionResult Details(int id)
    {
        Material material = consRepository.GetMaterial(id);
        return View();
    }

But why i get this error,

The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Details(Int32)' in 'CrMVC.Controllers.MaterialsController'. To make a parameter optional its type should be either a reference type or a Nullable type. Parameter name: parameters

Any suggestion...

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about detailsview