[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Background color for one cell in datagrid

=?Utf-8?B?cm9kY2hhcg==?=

3/1/2004 9:06:00 AM

Hi everybody

A simple question
How can i set the background color for a specific cell in a datagrid
I'm using a dataset to fill up the web control

Thankx
2 Answers

Teemu Keiski

3/2/2004 8:38:00 AM

0

Hi

in ItemCreated or ItemDataBound event handler

--
e.Item.Cells[0].BackColor=Color.Yellow;
--

You can do this in declarative syntax as well (of course), but you probably
pick the Color from data source?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Sebbe" <anonymous@discussions.microsoft.com> wrote in message
news:8BDB0CC0-D809-49E4-8A76-DC6D5E894A8C@microsoft.com...
> Hi everybody,
>
> A simple question:
> How can i set the background color for a specific cell in a datagrid ?
> I'm using a dataset to fill up the web control !
>
> Thankx


Teemu Keiski

3/2/2004 8:40:00 AM

0

Also note that in my code, you would need to know at which row you are if
you want to set one cell of one row to different color. The code I gave is
same as putting it in declarative syntax( changes color for all cells in
that column). You would need to check some row index etc to know which row's
cell you want to modify.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


"Sebbe" <anonymous@discussions.microsoft.com> wrote in message
news:8BDB0CC0-D809-49E4-8A76-DC6D5E894A8C@microsoft.com...
> Hi everybody,
>
> A simple question:
> How can i set the background color for a specific cell in a datagrid ?
> I'm using a dataset to fill up the web control !
>
> Thankx