I have put some additional logic into the ItemDataBound event to handle the conditional colour formatting which works perfectly on the initial screen display. However when i click on one of my column headers to sort my data by the column the formatting is lost on the sorted column.
Can anyone shed any light on why this is happening.
Here is my code from my ItemDataBound Event
Can anyone shed any light on why this is happening.
Here is my code from my ItemDataBound Event
protected
void
gridTxnEnquiry_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
DataRow dr = ((DataRowView)e.Item.DataItem).Row;
// Set the Back Colour depending on the Record Type
int
rectype =
int
.Parse(dr[
"RecordType"
].ToString());
switch
(rectype)
{
case
0:
dataItem.BackColor = Color.Blue
break
;
case
1:
dataItem.BackColor = Color.Red
break
;
}
}
}