HOW TO SHOW DETAILS VIEW IN MVC3?

Pawan Shukla

Total Post:29

Points:203
Posted by  Pawan Shukla
Mvc3 
 1073  View(s)
Ratings:
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();

    }

  1. Hugh Jackman

    Post:52

    Points:366
    Re: How to show details view in mvc3?

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!