or
In my grid I have made GridTemplateColumns with labels inside to display text of various colors. I determine the different color for the text in the code behind of the RadGrid1_ItemDataBound event. However, I would like to go away from this and just change the forcolor of the text in a GridBoundColumn.
How can I access the GridBoundColumn from the code behind in the RadGrid1_ItemDataBound event?
This is how I get a labels properties, but I can't get it to work for GridBoundColumns.
| Label time = (Label)e.Item.Cells[0].FindControl("LabelTime"); |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| var grid = RadGrid1; |
| foreach (GridColumn column in grid.Columns) |
| { |
| if (column is GridDateTimeColumn) |
| { |
| var editor = (column as GridDateTimeColumn).CurrentColumnEditor as GridDateTimeColumnEditor; |
| var picker = editor.PickerControl as RadDateTimePicker; |
| picker.DatePopupButton.ToolTip = "XXXX"; // why no effect??? |
| } |
| } |
| } |