Is it possible to customized Datagrid at the row level?

  • Thread starter Thread starter IRAS Blues
  • Start date Start date
I

IRAS Blues

When I bind a DataTable to a DataGrid, is it possible to impose
conditions such that if a condition is met, I do something like
highlight the entire row in red?

Thanks in advance for any answers,
Wong
 
I've assumed you were talking about the ASP.NET datagrid.

----- Suresh wrote: -----

Yes. Handle the ItemDataBound event of your datagrid. One of the parameters that's emitted when this event is fired is the DatagridItem. Using the DataGridItem you can iterate thru the cells of the row and set their style and other cosmetic properties.

(i.e. in C#)
e.Item.Cells[0].CssClass = "RedBackground";

Visit the following link.
http://msdn.microsoft.com/library/d...controlsdatalistclassonitemdataboundtopic.asp

Suresh.

----- IRAS Blues wrote: -----

When I bind a DataTable to a DataGrid, is it possible to impose
conditions such that if a condition is met, I do something like
highlight the entire row in red?

Thanks in advance for any answers,
Wong
 
Back
Top