changing the color of a cell in a datagrid

  • Thread starter Thread starter Franck
  • Start date Start date
F

Franck

hello,
I'm trying to change the color of certain cells
in a datagrid according to their values?

I tried to get the value in the Datagrid_ItemCreated event but I couldn't

I don't know where else to start?

any help?
thank you
 
what was wrong with the _ItemCreated call?
Also, look at the _ItemBound (or is it _ItemDataBound?) event.
 
HI,
You cant do it in the Item created event. You should do it in the itembound
event.
Regards,
P.Nishanthan
 
Curt_C said:
what was wrong with the _ItemCreated call?
Also, look at the _ItemBound (or is it _ItemDataBound?) event.

In the ItemCreated event the data's not yet been bound to the
DataGridItem, so you can't reference the data. Hence you need to use
the ItemDataBound event, as you noted.
 
ItemDataBound and PreRender are the right events to use.

Eliyahu
 
Depending on where the data is coming from though....

But yeah, you are right. The Bound is the better place.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com



Scott Mitchell said:
Curt_C said:
what was wrong with the _ItemCreated call?
Also, look at the _ItemBound (or is it _ItemDataBound?) event.

In the ItemCreated event the data's not yet been bound to the
DataGridItem, so you can't reference the data. Hence you need to use
the ItemDataBound event, as you noted.



--

Scott Mitchell [ASP.NET MVP]
(e-mail address removed)
http://www.4GuysFromRolla.com/ScottMitchell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top