Home > DeveloperSection > Forums > How to show details view in mvc3?
Pawan Shukla
Pawan Shukla

Total Post:29

Points:203
Posted on    November-10-2014 2:29 AM

 ASP.NET MVC Mvc3 
Ratings:


 1 Reply(s)
 712  View(s)
Rate this:

HI i am new to mvc so if anyone can help me will be great basically i just want to display a partiular item details, my code

    private sneakerEntities

       _sneaker_categoryDataModel = new sneaker_info.Models.sneakerEntities();

    public ActionResult Index()

    {

        IList<sneaker> Releases = _sneaker_categoryDataModel.sneakers.ToList<sneaker_info.Models.sneaker>();

        return View("Releases", Releases);

    }

    public ActionResult Details (int id)

    {

        return View();

    }



Hugh Jackman
Hugh Jackman

Total Post:52

Points:366
Posted on    November-10-2014 5:22 AM

You need to find it from Repository and display in your strongly typed view

public ActionResult Details (int id)

{

   Sneaker snkr=_sneaker_categoryDataModel.sneakers.Find(id);

   return View(snkr);

}

In Details.cshtml

@model Sneaker

//all view related code


Don't want to miss updates? Please click the below button!

Follow MindStick