在GridView ASP.NET中更改数据框



如何通过databoud在gridview asp.net中更改颜色/背色,我尝试这样的错误。这个问题有解决方案。谢谢

私有sub gridview1_rowdatabound(byval发件人作为对象,byval e as system.web.ui.webcontrols.gridviewroweventargs(处理gridview1.rowdatabound

>
        If e.Row.RowType = DataControlRowType.DataRow Then
            If (e.Row.Cells(1).Text) = "102" Then
                e.Row.Cells(1).BackColor = System.Drawing.Color.Red
            End If
        End If
End Sub
if (e.Row.Cells[0].Text == "12")
          {
              e.Row.Cells[0].ForeColor = System.Drawing.Color.Red;
          }
else if(e.Row.Cells[0].Text == "13")
          {
              e.Row.Cells[0].ForeColor = System.Drawing.Color.Yellow;
          }

最新更新