默认bit类型的字段是复选框 可以改为显示 true或者false  但是我想显示成0/1的格式 要怎么设置呢

解决方案 »

  1.   

    不用设置,绑定时操作即可
    if(e.Row.Cells[0].Text=="True")
    e.Row.Cells[0].Text ="1";
      

  2.   

    <%# ((bool)Eval("boolValue")) ? "1" : "0" %>
      

  3.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
    if(e.Row.RowType == DataControlRowType.DataRow )
    {
            if(e.Row.Cells[单元格索引].Text=="True")
             e.Row.Cells[单元格索引].Text ="1";
            else e.Row.Cells[单元格索引].Text ="0";
    }    }