Hi,
I am working on a project and I want to change the forecolor of the first three rows of the radgrid and also make it bold so as to show that those top three records are the leading results in the radgrid.
Please help with how I can achieve this.
Thanks
I am working on a project and I want to change the forecolor of the first three rows of the radgrid and also make it bold so as to show that those top three records are the leading results in the radgrid.
Please help with how I can achieve this.
Thanks
4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 28 Nov 2012, 07:58 AM
Hi,
You can set the forecolor and font size in ItemDataBound event as shown below.
C#:
Thanks,
Shinu.
You can set the forecolor and font size in ItemDataBound event as shown below.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
if
(item[
"Uniquename"
].Text ==
"text"
)
{
item.ForeColor = System.Drawing.Color.Red;
item.Font.Bold =
true
;
}
}
}
Thanks,
Shinu.
0

Ufuoma
Top achievements
Rank 1
answered on 28 Nov 2012, 08:09 AM
Thanks Shinu.
What do you mean by '[Unique name].Text'... It is throwing an error.
Please can you give me the exact code for formatting the top 3 rows of the radgrid because I do not know how to customize the code you posted earlier.
Thanks
What do you mean by '[Unique name].Text'... It is throwing an error.
Please can you give me the exact code for formatting the top 3 rows of the radgrid because I do not know how to customize the code you posted earlier.
Thanks
0

Ufuoma
Top achievements
Rank 1
answered on 28 Nov 2012, 08:16 AM
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
if (item.RowIndex <=2)
{
item.ForeColor = System.Drawing.Color.Red;
item.Font.Bold = true;
}
}
}
But its not working properly.
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
if (item.RowIndex <=2)
{
item.ForeColor = System.Drawing.Color.Red;
item.Font.Bold = true;
}
}
}
0

Princy
Top achievements
Rank 2
answered on 29 Nov 2012, 06:52 AM
Hi,
You can set the forecolor using ItemIndex as shown below.
C#:
Thanks,
Princy.
You can set the forecolor using ItemIndex as shown below.
C#:
protected
void
RadGrid2_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
if
(item.ItemIndex <=2)
{
item.ForeColor = System.Drawing.Color.Red;
item.Font.Bold =
true
;
}
}
}
Thanks,
Princy.