如何使用asp.net mvc将数据导出到excel时将checkbox转换为gridview中的string值?

如何使用asp.net mvc将数据导出到excel时将checkbox转换为gridview中的string值? 模型:公共类empViewmodel {

public int id { get; set; } public string name { get; set; } public string address { get; set; } public bool male{ get; set; } public Nullable<int> city_id { get; set; } } 

控制器:

 public ActionResult export1(emplyeeModel em) { var grid = new GridView(); grid.DataSource = e1.getlist(em); grid.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); grid.RenderControl(htw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); return View("export"); } 

获取列表方法:

  public List<emplyeeModel> getlist(emplyeeModel e1) { var tbl =db.emps.ToList(); List<emplyeeModel> lst = new List<emplyeeModel>(); foreach (var item in tbl) { emplyeeModel M1 = new emplyeeModel(); M1.id = item.id; M1.name = item.name; M1.address = item.address; M1.male= item.gender; lst.Add(M1); } return lst; } 

在这个男性列是布尔值,它显示checkbox,但我想显示string是/否(True / False)而不是checkbox,而导出数据到Excel