This is a migrated thread and some comments may be shown as answers.

Selector erases forecolor that i set runtime

2 Answers 22 Views
Grid
This is a migrated thread and some comments may be shown as answers.
e-statik
Top achievements
Rank 1
e-statik asked on 21 Oct 2008, 06:36 AM
I'm setting forecolor programmaticaly on ItemDataBound event:
    if (condition...)
        e.Item.ForeColor = Color.SomeColor...

When i selecting the row on client side selector sets its style's color and next, when i deselect the row, the color i have set erased. Default color of current skin comes back.

Is there any way to make selector remembers my color and sets it back?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Oct 2008, 07:46 AM
Hi,

When you set a custom style to a grid row and it does not get applied, then there is an overriding style with higher specificity in the grid skin. Try changing the row style in its CSS class as shown and see if it helps.
cs:
  protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item;             
            if (condition is met) 
            { 
                item.CssClass = "RowColor"
            } 
        } 
    } 

js:
<head runat="server"
     
   <style type="text/css"
   .RowColor 
   { 
    color:Maroon !important; 
   } 
   </style> 
</head> 

Thanks
Princy.
0
e-statik
Top achievements
Rank 1
answered on 21 Oct 2008, 02:01 PM
Yes, it works, but it also kills all other default style settings )
Therefore i should copy all params to this class from current skin row class before...
Sure i can use predefined classes for each color. But isn't it too difficult/sophisticated for simply setting font color?
Tags
Grid
Asked by
e-statik
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
e-statik
Top achievements
Rank 1
Share this question
or