Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Setting color for a single cell in a datagrid.

Reply
Thread Tools

Setting color for a single cell in a datagrid.

 
 
UJ
Guest
Posts: n/a
 
      08-28-2006
How can I set the background color for a single cell dynamically in a
datagrid control? I know how to do the entire row but not the cell.

TIA - Jeff.


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      08-29-2006
You need first to navigate to the cell and then set its BackColor property.
Navigation to cell depends on in what place in the code you want to do it.
If you are in the ItemDataBound event, which is the most common place for
handling this sort of tasks, you get a reference to the datagrid item (row)
as a parameter and you can use Cells collection to get to the cell. In
PageLoad or PreRender event you first navigate to the row in the grid and
then to the cell.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


"UJ" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How can I set the background color for a single cell dynamically in a
> datagrid control? I know how to do the entire row but not the cell.
>
> TIA - Jeff.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing font color from current font color to black color Kamaljeet Saini Ruby 0 02-13-2009 04:58 PM
Problem with setting background color alternating item in datalist to a certain color fig000 ASP .Net Web Controls 0 09-06-2004 06:51 PM
How to set and highlight text in JTable cell on selection and/or invoke cell editor directly. news.rcn.com Java 1 07-12-2004 10:22 PM
How do I have a table cell fetch another page to display within the cell? Phillip Roncoroni HTML 14 04-05-2004 05:58 PM
multilink cell phones multilinking shotgun 2 cell phones Calvin Cisco 1 11-07-2003 02:20 PM



Advertisments