4 Answers, 1 is accepted
0
Hi Michael,
Could you please try the following approach?
That should do the trick. Please give it a try and let me know about the result.
Kind regards,
Eyup
the Telerik team
Could you please try the following approach?
int
index = -1;
decimal
maxNumber =
decimal
.MinValue;
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = e.Item
as
GridDataItem;
decimal
currentNumber =
decimal
.Parse(dataItem[
"Freight"
].Text);
if
(currentNumber > maxNumber)
{
maxNumber = currentNumber;
index = dataItem.ItemIndex;
}
}
}
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(index >= 0)
{
GridTableCell cell = (RadGrid1.Items[index]
as
GridDataItem)[
"Freight"
]
as
GridTableCell;
cell.BackColor = System.Drawing.Color.LightBlue;
}
}
That should do the trick. Please give it a try and let me know about the result.
Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Michael
Top achievements
Rank 1
answered on 18 Sep 2012, 11:51 AM
This works for one row but doesn't do it for each column.
0
Accepted
Hi Michael,
In this case you could use the approach shown below:
I hope this will prove helpful.
All the best,
Eyup
the Telerik team
In this case you could use the approach shown below:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
string
[] numericColumns = {
"OrderID"
,
"Freight"
,
"Freight1"
,
"Freight2"
};
foreach
(
string
uniqueName
in
numericColumns)
{
int
index = -1;
decimal
maxNumber =
decimal
.MinValue;
foreach
(GridDataItem dataItem
in
RadGrid1.MasterTableView.Items)
{
decimal
currentNumber =
decimal
.Parse(dataItem[uniqueName].Text);
if
(currentNumber > maxNumber)
{
maxNumber = currentNumber;
index = dataItem.ItemIndex;
}
}
if
(index >= 0)
{
GridTableCell cell = (RadGrid1.Items[index]
as
GridDataItem)[uniqueName]
as
GridTableCell;
cell.BackColor = System.Drawing.Color.LightBlue;
}
}
}
I hope this will prove helpful.
All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Michael
Top achievements
Rank 1
answered on 22 Sep 2012, 08:43 PM
Thanks Eyup. That worked great. Exactly what I was looking for.