C#取值并修改颜色!! this.resultColumns.Add(new BoundField() { HeaderText = "温度", DataField = "TemperValue", SortExpression = "TemperValue" });代码如上所示。我怎么取出dataField中的值。并且根据不同的值修改颜色呢?各位大虾帮帮忙!!!急急!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 问题还是没看懂你点击的哪个控件,就大哪个控件里写事件取值根据取出来的值,写个switchcase去判断并修改颜色 获取那一列设置Style如果是控件,用FindControl找到控件,在设置Style 问题已经解决了。这是自己写的代码for (int i = 0; i < gridView.Rows.Count; i++) { int a; int b; a = Convert.ToInt32((gridView.Rows[i].Cells[7].Controls[0] as HyperLink).Text.ToString().Trim()); b = Convert.ToInt32((gridView.Rows[i].Cells[8].Controls[0] as HyperLink).Text.ToString().Trim()); if ((a > 30 && a < 100) || (b > 30 && b < 100)) { this.gridView.Rows[i].Cells[0].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[1].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[2].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[3].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[4].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[5].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[6].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[7].BackColor = System.Drawing.Color.Yellow; this.gridView.Rows[i].Cells[8].BackColor = System.Drawing.Color.Yellow; } C# 多线程 winsock发送数据 VB代码转换成C#代码. 在C#窗体程序中,如何判断textbox控件中输入的格式是浮点型 c#执行sql存储过程,出了怪事。专家指教 在线等 求Rational XDE Developer Plus for VS.NET 2003的用法! 各位现在都在做些什么。 应用程序加锁问题??? 如何把一个数组放入datarow 请问如何将一个表中记录(SQL 2000)的总数赋给一个变量,然后可以在C#代码中使用这个变量?TKS HASHTABLE的问题 怎样在DataTable中继续查询?
问题还是没看懂你点击的哪个控件,就大哪个控件里写事件取值根据取出来的值,写个switchcase去判断并修改颜色
如果是控件,用FindControl找到控件,在设置Style
for (int i = 0; i < gridView.Rows.Count; i++)
{
int a;
int b;
a = Convert.ToInt32((gridView.Rows[i].Cells[7].Controls[0] as HyperLink).Text.ToString().Trim());
b = Convert.ToInt32((gridView.Rows[i].Cells[8].Controls[0] as HyperLink).Text.ToString().Trim());
if ((a > 30 && a < 100) || (b > 30 && b < 100))
{
this.gridView.Rows[i].Cells[0].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[1].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[2].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[3].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[4].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[5].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[6].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[7].BackColor = System.Drawing.Color.Yellow;
this.gridView.Rows[i].Cells[8].BackColor = System.Drawing.Color.Yellow;
}