【发布时间】:2013-07-25 16:13:24
【问题描述】:
我的 gridview 是从从 SQL 读取的 Datatable 动态生成的,现在我想设置一个特定的列,比如“salary”,使其具有红色背景色。我已经搜索了很多解决方案,但仍然没有任何线索。
CmdString = @" select id, firstname, lastname, title, level, salary from emplpyees";
SqlCommand cmd = new SqlCommand(CmdString, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
dt = new DataTable("employee");
sda.Fill(dt);
datagridall.ItemsSource = dt.DefaultView;
【问题讨论】:
-
您是否尝试过使用 DataGridTemplateColumn?