Data Grid Coloured Cell..
-
Hi: I have a datagrid that displays two columns say fruit name,fruit colour from the database..The fruit colour columns is rendered invisible. What do i do to make the font colour on the datagrid cell that displays fruit name as the colour specified in the "fruit colour column" for eg: if i have apple red then the cell displaying apple must be haveing red font.. This project is done on asp.net,VB.NET,windows xp platform,IE 6.0. Thanks in advance for the help. Regards Pradhip.S If Fed-EX and UPS merged whats the new company called--FedUp??
-
Hi: I have a datagrid that displays two columns say fruit name,fruit colour from the database..The fruit colour columns is rendered invisible. What do i do to make the font colour on the datagrid cell that displays fruit name as the colour specified in the "fruit colour column" for eg: if i have apple red then the cell displaying apple must be haveing red font.. This project is done on asp.net,VB.NET,windows xp platform,IE 6.0. Thanks in advance for the help. Regards Pradhip.S If Fed-EX and UPS merged whats the new company called--FedUp??
Pradhip wrote: VB.NET First step is to stop using VB. X| You need to override the OnItemCreated method of the datagrid.
private void OnItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ) e.Item.Cells[FruitCell].BackColor = Color.FromName(e.Item.Cells[ColorCell].Text); }
-
Pradhip wrote: VB.NET First step is to stop using VB. X| You need to override the OnItemCreated method of the datagrid.
private void OnItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if( e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ) e.Item.Cells[FruitCell].BackColor = Color.FromName(e.Item.Cells[ColorCell].Text); }
Thanks Mark: Your Code Worked cool.And there is also an article on www.pinnaclepublishing.com(check out on asp.net) for the november month that discusses the ItemDataBoundEvent in detail.. Link for the article:-http://www.pinnaclepublishing.com/activeweb/AWmag.nsf/0/F1D90C2E7F032EE785256C6F005E6B15 Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??