CODE: public ActionResult ShowHrEmployeeRec(int? EmplID = null) { if (!String.IsNullOrEmpty(Session["Admin"] as string)) { IEnumerable<GetHrEmployeeResult> HrEmployee = DataContext.GetHrEmployee(EmplID).ToList(); ViewBag.Month = Request.QueryString["Month"]; return View(HrEmployee); } else { return RedirectToAction("IsAuth_Page", "Home"); } VIEW: @{ var grid = new WebGrid(ViewData.Model, defaultSort: "EmplID", rowsPerPage: 1); } @if (Model.Count > 0) { <div id="AllEmpGrid_ByName"> @grid.GetHtml(columns: grid.Columns( grid.Column("EmplID", "Employee ID"), grid.Column("EmplName", "Employee Name"), grid.Column("DeptName", "Department"), grid.Column("ShiftName", "Shift"), grid.Column("EntryDate", "Entry Date"), grid.Column("BasicSalary", "Basic Salary"), grid.Column("EmailAdd", "Email"), grid.Column("OvertimeApproved", "Overtime Approval") )) </div> }
SELECT IIF(IsApproved, "YES", "NO") AS OvertimeApproved
select col1, col2 = case when IsApproved != 0 then "yes" else "no" end, col 3 from mytable
grid.Column("OvertimeApproved", header: "Overtime Approval", format: @<text> @if(item.IsApproved) { <span>Yes</span> } else { <span>No</span> } </text> )
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)