datagridview 按数字 排序

 int val1, val2;
            int.TryParse(e.CellValue1.ToString().Trim(), out  val1);
            int.TryParse(e.CellValue2.ToString().Trim(), out  val2);

            if (val1 < val2) e.SortResult = -1;
            else if (val1 == val2) e.SortResult = 0;
            else e.SortResult = 1;
            e.Handled = true;

 

posted on 2012-10-30 11:01  酒歌  阅读(537)  评论(0编辑  收藏  举报