@model IEnumerable<ForumMVC.Employee> @{ ViewBag.Title = "Bind Gridview with Database"; WebGrid grid = new WebGrid(Model); } <h2>Bind GridView in MVC4 with Database</h2> @grid.GetHtml(columns: new[] { grid.Column("Emp_ID"), grid.Column("Emp_Name"), grid.Column("Emp_Sal") } )
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Threading.Tasks; using System.Diagnostics; using ForumMVC; namespace ForumMVC.Controllers { public class HomeController : Controller { forumEntities db = new forumEntities(); public ActionResult Index() { IEnumerable<Employee> LIst = db.Employee.ToList(); return View(LIst); }
} }
Liked By
Write Answer
How to Bind GridView in MVC4 with Database
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
24-Nov-2015