Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:27:11+00:00 2026-05-28T06:27:11+00:00

I have my template file which has data being populated into it. However I

  • 0

I have my template file which has data being populated into it. However I want to be able to write a class to every odd list element.

The issue i have is that some of the fields being listed are hidden when there is no data and as such i cannot simply write in the class of every other element.

I know I could do this using javascript, but would prefer not to.

Is there any way I can use the page_prerender to look at which list items are going to be displayed and add a class to each odd element?

for example my template looks like this but with many more fields:

    <ul>
    <li>
    <h3>Data title</h3>
    <p><%=GetDymanicData1 %></p>
    </li>
<!-- if statement to check if data has value, else do not show -->
    <li>
    <h3>Data title</h3>
    <p><%=GetDymanicData2 %></p>
    </li>
    <li>
    <h3>Data title</h3>
    <p><%=GetDymanicData2 %></p>
    </li>
    ...
    </ul>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:27:12+00:00Added an answer on May 28, 2026 at 6:27 am

    Description

    This is not c# this is a question about html and css.

    You can do this in pure css. Check out my sample and this jsFiddle Demonstration

    Sample

    CSS

    li:first-child {background: #FF0}
    li:nth-child(2n+3) {background: #CCC}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Velocity template file which has the data from XML . I
I have a Smarty template file in which I'm looping over hierarchical data represented
I have a file template.txt which contains the following: Hello ${something} I would like
I have this code which will include template.php file from inside each of these
Background I have written a test suite in mstest which has a template XML.
I have: $page_file_temp = $_SERVER[PHP_SELF]; which will output: /templates/somename/index.php I want to extract from
I have a template file in a folder c:\template_folder. At runtime, I will create
Absolute beginner question: I have a template file index.html that looks like this: ...
I have an XML Template file. This file contains a header and some predefined
I have a rails template (.rhtml file) generating a Javascript object. It looks something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.