How to show details view in mvc3?

Total Post:29

Points:203
Mvc3 
 1307  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. Post:51

    Points:359
    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

      Modified On Apr-06-2018 05:25:06 AM

Answer

NEWSLETTER

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