1
我在我的一个gridview列中有一个值,它将确定整行的值是否应为红色。我做了下面,但不知何故每一行都是红色的。请提供建议。谢谢。根据列字段值更改gridview行forecolor
Protected Sub uigvList_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles uigvList.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
If Not (DataBinder.Eval(e.Row.DataItem, "VoidOn")) Is Nothing Then ' This is the condition, if this field is not blank then I want to the entire row to have red colored values.
e.Row.BackColor = Drawing.Color.Firebrick
End If
End If
End Sub
http://stackoverflow.com/questions/4867283/change-the-font-color-gridview-row-based-on-a-columns-value-cant-index-gridview –
你可以尝试RowDataBound事件而不是RowCreated并将颜色应用于每个单元格,而不是一次将整个行应用,因为在某些浏览器中将颜色应用于行'
回答
也许DBNull.Value?
PS:您可以在调试模式VoidOn值,只需设置断点的代码行。
来源
2012-01-11 17:22:17
相关问题