title: How to convert checkbox into string value in gridview?
body: <p>How can I convert a checkbox into a string value in gridview whilst exporting data into excel using asp.net mvc?</p>
  
  <p>Model:</p>
  
  <pre><code>    public class empViewmodel
      {         
          public int id { get; set; }
          public string name { get; set; }
          public string address { get; set; }
          public bool male{ get; set; }
          public Nullable&lt;int&gt; city_id { get; set; }
      }
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>    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");
      }
  </code></pre>
  
  <p>Getlist method:</p>
  
  <pre><code>        public List&lt;emplyeeModel&gt; getlist(emplyeeModel e1)
          {
              var tbl =db.emps.ToList();
              List&lt;emplyeeModel&gt; lst = new List&lt;emplyeeModel&gt;();
              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;
          }
  </code></pre>
  
  <p>In the male column is a boolean and it displays a checkbox but I want to display string yes/no(True/False) instead of a checkbox, while exporting data into excel.</p>