Hi
I have a grid where I set the backcolor under certain situations, but when sorting one column, that formatting dissapears, I do get a GridPagerItem back in ItemDataBound instead of GridDataItem, so how do I ensure that my backcolor gets set no matter what type of column I have?
This is my code in ItemDAtaBound which works fine except when I click on a c0olumn to sort it, then that column does not have the colors anymore
If e.Item.OwnerTableView.Name = "AlleTilbud" Then
If TypeOf (e.Item) Is GridDataItem Then
Dim item As GridDataItem = e.Item
Dim farve As System.Drawing.Color = item.BackColor
If item("tilbudtdato").Text = " " Then
item.BackColor = System.Drawing.Color.Yellow
item("statustext").Text = "Ikke i tilbud"
Else
item.BackColor = farve
item("statustext").Text = "Tilbud"
End If
If item("svarfristdato").Text <> " " Then
Dim dt As Date = CDate(item("svarfristdato").Text)
If dt < Now Then
item.BackColor = System.Drawing.Color.Red
item("statustext").Text = "Svarfrist overskredet"
End If
End If
If item("kontraktdato").Text <> " " Then
item.BackColor = farve
item("statustext").Text = "Kontrakt udskrevet"
End If
If item("status").Text.ToUpper() = "S" Then
If item("indflyttersaldo").Text <> " " Then
Dim betalt As Decimal = CDec(item("indflyttersaldo").Text)
If betalt = 0 Then
item.BackColor = farve
item("statustext").Text = "Kontrakt betalt"
End If
End If
End If
End If
End If
I have a grid where I set the backcolor under certain situations, but when sorting one column, that formatting dissapears, I do get a GridPagerItem back in ItemDataBound instead of GridDataItem, so how do I ensure that my backcolor gets set no matter what type of column I have?
This is my code in ItemDAtaBound which works fine except when I click on a c0olumn to sort it, then that column does not have the colors anymore
If e.Item.OwnerTableView.Name = "AlleTilbud" Then
If TypeOf (e.Item) Is GridDataItem Then
Dim item As GridDataItem = e.Item
Dim farve As System.Drawing.Color = item.BackColor
If item("tilbudtdato").Text = " " Then
item.BackColor = System.Drawing.Color.Yellow
item("statustext").Text = "Ikke i tilbud"
Else
item.BackColor = farve
item("statustext").Text = "Tilbud"
End If
If item("svarfristdato").Text <> " " Then
Dim dt As Date = CDate(item("svarfristdato").Text)
If dt < Now Then
item.BackColor = System.Drawing.Color.Red
item("statustext").Text = "Svarfrist overskredet"
End If
End If
If item("kontraktdato").Text <> " " Then
item.BackColor = farve
item("statustext").Text = "Kontrakt udskrevet"
End If
If item("status").Text.ToUpper() = "S" Then
If item("indflyttersaldo").Text <> " " Then
Dim betalt As Decimal = CDec(item("indflyttersaldo").Text)
If betalt = 0 Then
item.BackColor = farve
item("statustext").Text = "Kontrakt betalt"
End If
End If
End If
End If
End If