列中的数据 是 0和1, 想当数据是0的时候 显示 男, 1的时候显示女! 谢谢大家!

解决方案 »

  1.   

    列的ColumnEdit选择LookupEdit
    LookupEdit中添加两列,代码中将它绑定DataTable(select id=0,name='男' union select id=1,name='女')LookupEdit.DataSource = dtSex
    LookupEdit.Columns(0).FieldName = "id"
    LookupEdit.ValueMember = "id"
    LookupEdit.Columns(1).FieldName = "name"
    LookupEdit.DisplayMember = "name"再设置GridControl.DataSource就可以了
      

  2.   

    在绑定前,先做个判断
    data==0?‘男’:‘女’;
      

  3.   

     /// <summary>
            /// 码表转换
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void gridView1_DataSourceChanged(object sender, EventArgs e)
            {            //数据行数
                int c = gridView1.RowCount;
                for(int i=0;i<c;i++)
                {
                    string strText  = Utility.DictUtil.GetDictText("部门名称",this.gridView1.GetRowCellValue(i, "CHECKDEPT").ToString());
                    this.gridView1.SetRowCellValue(i, "CHECKDEPT", strText);
                }
         
            }
      

  4.   

    CustomColumnDisplayText 事件里面搞具体做法请参考官方文档http://documentation.devexpress.com/#WindowsForms/DevExpressXtraGridViewsBaseColumnView_CustomColumnDisplayTexttopic
      

  5.   

     string strText  = Utility.DictUtil.GetDictText("部门名称",this.gridView1.GetRowCellValue(i, "CHECKDEPT").ToString());
                    this.gridView1.SetRowCellValue(i, "CHECKDEPT", strText);改成string strText = this.gridView1.GetRowCellValue(i, "CHECKDEPT").ToString()=="1"?"男":"女";
    this.gridView1.SetRowCellValue(i, "CHECKDEPT", strText);
      

  6.   

    string strText = this.gridView1.GetRowCellValue(i, "CHECKDEPT").ToString()=="0"?"男":"女";
      

  7.   

    只用来显示的话,也可以用Unbound列
      

  8.   

    在你select 查询的时候直接替换了也可以滴
      

  9.   

    我绝对的数据库直接查转换男女 即可,,,直接绑定
    case sex when 0 then ‘男’,,,等等,,,,