繁体   English   中英

如何在Gridview文本上使用大于?

[英]How can I use greater than on Gridview text?

我有这样的Gridview:

在此输入图像描述

Zero线大于%10时,我需要更改背景色。

我试过这样(只有15%):

if (e.Row.Cells[0].Text == "Zero")
{
   for (int i = 0; i < e.Row.Cells.Count; i++)
   {
      if (e.Row.Cells[i].Text == "15%")
      {
         e.Row.Cells[i].BackColor = System.Drawing.Color.LightCoral;
      }
   }
}

由于%我无法将Row.Cells[i].Text转换为Int 如何使用大于10的背景颜色?

只是替换

if (e.Row.Cells[i].Text == "15%")

if (int.Parse(e.Row.Cells[i].Text.Trim('%'))>10)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM