protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label olabel;
//弹出明细行的数据的 背景色改掉!
if (e.Row.RowType == DataControlRowType.Header )
{
for (int iCol = 0; iCol < e.Row.Cells.Count; iCol++)
{
if (e.Row.Cells[iCol].Text.ToString().IndexOf("小计") > 0)
//这个TEXT取出的值永远是空的?列是自动生成的 后在DATAROW里 这样写是可以取到值的,不知道为什么
{
e.Row.Cells[iCol].BackColor = System.Drawing.Color.Green;
}
{
Label olabel;
//弹出明细行的数据的 背景色改掉!
if (e.Row.RowType == DataControlRowType.Header )
{
for (int iCol = 0; iCol < e.Row.Cells.Count; iCol++)
{
if (e.Row.Cells[iCol].Text.ToString().IndexOf("小计") > 0)
//这个TEXT取出的值永远是空的?列是自动生成的 后在DATAROW里 这样写是可以取到值的,不知道为什么
{
e.Row.Cells[iCol].BackColor = System.Drawing.Color.Green;
}
if (e.Row.Cells[iCol].Text.ToString().IndexOf("小计") > -1) 试试吧,应该可以的。可以的话,别忘给分喔,谢谢!
if (this.GridView1.Columns[iCol].HeaderText.ToString()=="小计")
在DATAROWBOUND时 COLUMNS 只有1列!!!!!