_Employee in shared
-
@modell IEnumerable @{ ViewBag.Title = ""; WebGrid grid = new WebGrid(Model, rowsPerPage: 5, ajaxUpdateContainerId: "gridContent"); Layout = null; } .table { margin: 4px; border-collapse: collapse; width: 300px; } .header { background-color: gray; font-weight: bold; color: #fff; } .table th, .table td { border: 1px solid black; padding: 5px; } @grid.GetHtml( tableStyle: "table", // applying style on grid fillEmptyRows: false, //show empty row when there is only one record on page to it will display all empty rows there. headerStyle: "header", //applying style. footerStyle: "grid-footer", //applying style. mode: WebGridPagerModes.All, //paging to grid firstText: "<< First", previousText: "< Prev", nextText: "Next >", lastText: "Last >>", columns: new[] // colums in grid @Html.DropDownList("Names", "Employee Names") { grid.Column("ID", canSort: false),//the model fields to display grid.Column("Name",canSort: false,format: @@item.Name), grid.Column("Gender",canSort: false, format: @@item.Gender), grid.Column("Email",canSort: false,format: @@item.Email), @* grid.Column("Role",canSort: false,format: @ @Html.DropDownList("Names","Employee Role") ) , *@ grid.Column("Action", canSort: false,format: @ ) }) @* *@