G
Guest
Hello,
I have run into an issue when using the OnRowDataBound event to apply
conditional formatting to a row. I need to check a specific column to see if
the value from the database is null. Without conditional formatting the page
just shows empty text in the table when the database column is null. I
figured the text value would be equivalent to "" but that doesn't work. Here
is a code snippet:
Protected Sub Grid_Databound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(10).Text = "" Then e.Row.Cells(10).Text = "blank"
End If
End Sub
This does not work - the text on the page always displays empty, it never
shows "blank". Am I missing something obvious? Is there a way to do this
using code similar to what I have above, or do I need to use a template
column along with a label control?
Thanks,
John
I have run into an issue when using the OnRowDataBound event to apply
conditional formatting to a row. I need to check a specific column to see if
the value from the database is null. Without conditional formatting the page
just shows empty text in the table when the database column is null. I
figured the text value would be equivalent to "" but that doesn't work. Here
is a code snippet:
Protected Sub Grid_Databound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(10).Text = "" Then e.Row.Cells(10).Text = "blank"
End If
End Sub
This does not work - the text on the page always displays empty, it never
shows "blank". Am I missing something obvious? Is there a way to do this
using code similar to what I have above, or do I need to use a template
column along with a label control?
Thanks,
John