Return View(Db.Employees.Tolist())

Return View(Db.Employees.Tolist())



I don’t think you need to be showing all of that code for your problem. I suggest removing the View Page code. Although, you have got an answer which seems correct, you should avoid adding too much code bloat as it can deter some users from wanting to read the question and therefore answering it too – musefan Oct 18 ’11 at 16:30, I think your view is not receiving List please use this. View : @model List @foreach(var item in Model) { //code here } Controller: public ActionResult Index() { ESSEntities DB = new ESSEntities() List EmpList = DB.Employees.ToList () return View (EmpList) }, 4/30/2016  · return View(db.Employees.ToList ()) } //Filter :/Employee/ [HttpPost] public ActionResult Index(string SearchName) { var Employee = from em in db.Employees where em.Name.Contains(SearchName) select em return View (Employee) } View : Add the view for index. Below given is code of view (Index.cshtml) …


4/16/2019  · return View (DB.Employees.ToList ()) } [HttpPost] public ActionResult Index (DateTime From,DateTime To) { Test1Entities1 DB = new Test1Entities1() return View (DB.SearchData(From, To)) } } } Step 7 . Right-click on the Index method and add a View . Step 8 . Now, add a form in the View and two date pickers. …


[OutputCache(Duration = 60)] public ActionResult Index() { return View(db.Employees.ToList ()) } In the example above, we specified the OutputCache settings within the code i.e. at the action method level. The problem with this approach is that, 1/21/2017  · var Employees = db.Employees.ToList () return View (Employees) Here we set Duration to 10 sec which means cached ActionResult/output will be expired after 10 sec.

Advertiser