5 Answers, 1 is accepted
0
Yes, ornus, this is possible through the CellFormatting event of RadGridView. Here is a code snippet on how to achieve this (we assume you have a custom column of type Point named "Custom"):
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement.ColumnInfo.UniqueName == "Custom")
{
Point point = (Point)e.CellElement.Value;
if (point.Y < 10)
e.CellElement.ForeColor = Color.Red;
else
e.CellElement.ForeColor = Color.Blue;
}
}
Let us know if you have other questions.
Kind regards,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement.ColumnInfo.UniqueName == "Custom")
{
Point point = (Point)e.CellElement.Value;
if (point.Y < 10)
e.CellElement.ForeColor = Color.Red;
else
e.CellElement.ForeColor = Color.Blue;
}
}
Let us know if you have other questions.
Kind regards,
Jack
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

bradley baker
Top achievements
Rank 1
answered on 23 Mar 2010, 08:22 PM
Can we still access cells via this method in the Q1 2010 version? When I try it says UniqueName is not a member of Telerik.WinControls.UI.GridViewColumn.
0
Hello bradley baker,
Yes, you can access the UniqueName property, which is now a property of the GridViewDataColumn. So, you should do a cast. We had to change this, because GridViewColumn is a base column type which is also inherited also from system columns which don't have unique names. Should you have other questions, feel free to contact me.
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Greetings,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

bradley baker
Top achievements
Rank 1
answered on 24 Mar 2010, 04:44 PM
Can you give an example. (VB pref)
0
Hi bradley,
here is the sample in VB:
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
here is the sample in VB:
Private
Sub
RadGridView1_CellFormatting(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.WinControls.UI.CellFormattingEventArgs)
Handles
RadGridView1.CellFormatting
Dim
column
As
GridViewDataColumn = TryCast(e.CellElement.ColumnInfo, GridViewDataColumn)
Dim
cell
As
GridDataCellElement = TryCast(e.CellElement, GridDataCellElement)
If
column IsNot
Nothing
And
column.UniqueName =
"Custom"
Then
Dim
point
As
Point =
CType
(cell.Value, Point)
If
point.Y < 10
Then
e.CellElement.ForeColor = Color.Red
Else
e.CellElement.ForeColor = Color.Blue
End
If
End
If
End
Sub
Best wishes,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.