Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Alternate row colors

Explorer ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

Could someone direct me to how to give alternate colors to rows with repeat region (without using datagrid) in CS3 C#

James
TOPICS
Server side applications

Views

1.1K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

.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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 22, 2008 Aug 22, 2008

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines