日期:2014-05-17  浏览次数:20833 次

怎样获得一个grid 里的列的名字?
就是一个grid里有很多行数据, 我通过对某些列的filter ,只显示某一部分行,我现在想要获得经过了filter的列的名字,  怎么获得啊?

------解决方案--------------------
是DataGridView?

   if(grid.CurrentCell!=null && grid.CurrentCell.ColumnIndex>=0)
   {
     grid.Columns[grid.CurrentCell.ColumnIndex].HeaderText  //列头文本
    grid.Columns[grid.CurrentCell.ColumnIndex].Name        //列对应的字段名
   }