悟生慧

 

获取DataGird的列名

 /// <summary>
        /// 获取DataGrid的列名
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        protected string[] getDTCol(System.Data.DataTable dt)
        {
            string cols = string.Empty;
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                cols += (dt.Columns[i].ColumnName + ",");
            }
            cols = cols.TrimEnd(',');
            return cols.Split(',');
        }

posted on 2011-06-05 10:34  悟生慧  阅读(254)  评论(0编辑  收藏  举报

导航