prav_roy
Well-known member
hi,
i am binding my datagrid to datatable, which have four columns, which works perfectly, my query is that in my first column im displaying different time slot, and in remaining three columns i have different program names, what i want to do is that depending on the column(1) entries i want to change the font color in column(0), ie if column(1) is empty then column(0) font should be black else it should be red..
my grid looks something like this
Time Prog1 Prog2 Prog3
04:30 anything anything anything
05:00 NO ENTRY anything anything
05:30 anything No Entry anything
06:00 NO ENTRY No Entry anything
06:30 anything anything No Entry
07:00 anything anything anything
(NO ENTRY means no text)
my font should depend on column(1) entry..
i used following code but it doesnt work
PrivateSub DataGrid1_ItemDataBound(ByVal sender AsObject, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
If e.Item.Cells(1).Text <> "" Then
e.Item.Cells(0).ForeColor = Color.Red
EndIf
EndIf
EndSub
can anybody help me on this
Thank you
i am binding my datagrid to datatable, which have four columns, which works perfectly, my query is that in my first column im displaying different time slot, and in remaining three columns i have different program names, what i want to do is that depending on the column(1) entries i want to change the font color in column(0), ie if column(1) is empty then column(0) font should be black else it should be red..
my grid looks something like this
Time Prog1 Prog2 Prog3
04:30 anything anything anything
05:00 NO ENTRY anything anything
05:30 anything No Entry anything
06:00 NO ENTRY No Entry anything
06:30 anything anything No Entry
07:00 anything anything anything
(NO ENTRY means no text)
my font should depend on column(1) entry..
i used following code but it doesnt work
PrivateSub DataGrid1_ItemDataBound(ByVal sender AsObject, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
If e.Item.Cells(1).Text <> "" Then
e.Item.Cells(0).ForeColor = Color.Red
EndIf
EndIf
EndSub
can anybody help me on this
Thank you