//选中行标注颜色 foreach (GridViewRow gvr1 in gv_Contract.Rows) { gvr1.BackColor = System.Drawing.Color.Empty;//没有颜色,透明 } gvr.BackColor = (System.Drawing.Color)(new System.Drawing.ColorConverter()).ConvertFromString("#669999"); 年龄: if (comm.IsDate(ds.Tables[0].Rows[0]["Birthday"].ToString())) { TimeSpan dt = DateTime.Now - DateTime.Parse(ds.Tables[0].Rows[0]["Birthday"].ToString()); decimal age = (dt.Days / 365); ds.Tables[0].Rows[0]["age"] = age; }