Posted 15 Sep 2011 Link to this post
protected
void
grvGrid_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
try
if
(e.Item
is
GridDataItem)
GridDataItem item = (GridDataItem)e.Item;
string
rowIndex = Convert.ToString(((DataTable)grvGrid.DataSource).Rows[e.Item.ItemIndex][
"IDKey"
]);
item.Attributes.Add(
"onclick"
,
"itemSelected('"
+ rowIndex +
"')"
);
foreach
(TableCell cell
in
e.Item.Cells)
cell.ToolTip = cell.Text.Replace(
" "
""
).Trim();
}
(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"StatusCD"
].ToString().Trim().Equals(
"Deleted"
))
e.Item.BackColor = System.Drawing.Color.LightPink;
"Discontinued"
e.Item.BackColor = System.Drawing.Color.LightGoldenrodYellow;
catch
(Exception ex)
Session[
"ErrorMessage"
] = ex.Message;
Response.Redirect(
"ErrorPage.aspx"
<style>
.RadGrid .rgHoveredRow
background-color
:Red
!important
;
</style>
Posted 10 May 2016 in reply to Jayesh Goyani Link to this post
Hi Jayesh.
I am facing exact same issue like Terry's with my RadGrid on applying a cell color based on some condition like below :
radGrid_ItemDataBound(
(item[
"SOME_COLUMN"
].Text.Equals(
"SOME_TEXT"
item[
].Style[
"background-color"
]=
"green"
I tried setting the style as you mentioned but that only changes the hover row color. The problem still persists with the new hover color. Also, I am using the Office2010Blue theme. Please advise how to fix this.
Posted 13 May 2016 Link to this post
GridDataItem item = e.Item
as
GridDataItem;
orgClass = e.Item.ItemIndex % 2 == 0 ?
"rgRow"
:
"rgAltRow"
item.CssClass = orgClass +
" customClassName"
<style type=
"text/css"
>
.RadGrid tr.customClassName {
: yellow;
div.RadGrid tr.rgSelectedRow {
#828282
RadGrid1_ItemDataBound(
sender, GridItemEventArgs e)
(item.ItemIndex % 3 == 0)
// custom condition
item.Font.Bold =
true