Home All Groups Group Topic Archive Search About

Can I read the relevant CSS class?

Author
23 Feb 2006 11:17 AM
Paul Cheetham
Hi,

I have a datagrid, where I have used CSS classes for the item style and
alternating item style.
The grid draws great when I load the page, but I have problems when I
want to select a line by clicking on it.

When a row is clicked on, I set the backcolor of that row in order to
show it highlighted.
BEfore I do this I read the current value of Backcolor for that row, so
that I can set it back to the same colour when it is not selected.

The problem is that because the colours of the rows are set in a CSS
style, the CSS values are not reflected in the BackColor property of the
datagrid rows.
If I explicitly set the row colours in the databound event, then
everything works fine.

How can I either:
- Read the required colour from the CSS in the databound event and
explicitly set the colour at that point.
OR
- Read the colour actaully used to draw the row when I click on it



I am using .Net 1.1 and VS 2003


Thankyou.

Paul Cheetham

Author
25 Feb 2006 10:08 PM
Thomas Phaneuf
Paul,
I have run into the same problem and come up empty after hours of searching.
If anyone has the answer, I would like to know it as well.
-Tom

Show quoteHide quote
"Paul Cheetham" <PAC.N***@dsl.pipex.com> wrote in message
news:enEFQrGOGHA.536@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> I have a datagrid, where I have used CSS classes for the item style and
> alternating item style.
> The grid draws great when I load the page, but I have problems when I want
> to select a line by clicking on it.
>
> When a row is clicked on, I set the backcolor of that row in order to show
> it highlighted.
> BEfore I do this I read the current value of Backcolor for that row, so
> that I can set it back to the same colour when it is not selected.
>
> The problem is that because the colours of the rows are set in a CSS
> style, the CSS values are not reflected in the BackColor property of the
> datagrid rows.
> If I explicitly set the row colours in the databound event, then
> everything works fine.
>
> How can I either:
> - Read the required colour from the CSS in the databound event and
> explicitly set the colour at that point.
> OR
> - Read the colour actaully used to draw the row when I click on it
>
>
>
> I am using .Net 1.1 and VS 2003
>
>
> Thankyou.
>
> Paul Cheetham