Skip to main content
Participant
August 21, 2008
Question

Alternate row colors

  • August 21, 2008
  • 4 replies
  • 1091 views
Could someone direct me to how to give alternate colors to rows with repeat region (without using datagrid) in CS3 C#

James
This topic has been closed for replies.

4 replies

Inspiring
August 22, 2008
You don't say if you are using any Server Controls at all. You only say you
do not want to use the DataGrid.

I think its correct to say all of the ASP.NET list controls support an
AlternatingItemStyle property declared in the HTML and the server then
initializes the object so we don't have to write factory patterns so often.
Unless of course you ask because you want to learn to program using the C#
language. Then I wonder why you just don't go use the web to learn C# and I
realize you may not know about the modulus operator (%) which you need to
use inside a for or a foreach loop to write the code yourself. Now that you
have the proper terminology eh? :-)

"kwame_za" <webforumsuser@macromedia.com> wrote in message
news:g8jfkm$dqu$1@forums.macromedia.com...
> Could someone direct me to how to give alternate colors to rows with
> repeat region (without using datagrid) in CS3 C#
>
> James

Inspiring
August 22, 2008
Right. Define a base style for <tr> and only modify it on the odd (or even)
rows.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"Michael Fesser" <netizen@gmx.de> wrote in message
news:dfara4htk3jjb0l8c229tp6hpba3ct3l6d@4ax.com...
> .oO(Murray *ACE*)
>
>>In PHP, it could be as simple as this -
>>
>><?php
>>
>>$toggle=0;
>>
>>?>
>><tr class="<?php echo $toggle?'odd':'even';$toggle = !$toggle; ?>">
>>
>>where 'odd' and 'even' are CSS custom classes specifying row background
>>color.
>
> I do it in a similar way, but I apply a class only to every second row,
> which is enough.
>
> Micha

Inspiring
August 21, 2008
.oO(Murray *ACE*)

>In PHP, it could be as simple as this -
>
><?php
>
>$toggle=0;
>
>?>
><tr class="<?php echo $toggle?'odd':'even';$toggle = !$toggle; ?>">
>
>where 'odd' and 'even' are CSS custom classes specifying row background
>color.

I do it in a similar way, but I apply a class only to every second row,
which is enough.

Micha
Inspiring
August 21, 2008
In PHP, it could be as simple as this -

<?php

$toggle=0;

?>
<tr class="<?php echo $toggle?'odd':'even';$toggle = !$toggle; ?>">

where 'odd' and 'even' are CSS custom classes specifying row background
color.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================


"kwame_za" <webforumsuser@macromedia.com> wrote in message
news:g8jfkm$dqu$1@forums.macromedia.com...
> Could someone direct me to how to give alternate colors to rows with
> repeat region (without using datagrid) in CS3 C#
>
> James