Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VB ASP.NET: If Odd / Even

Posted on 2011-09-12
2
451 Views
Last Modified: 2012-05-12

I use this code determine if  ItemIndex is equal to 1:
<%# IIf ( Container.ItemIndex = 1, "Even", "Odd")%> 

Open in new window


How can I determine if ItemIndex is an odd number?
0
Comment
Question by:hankknight
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 400 total points
ID: 36523986
Try:
<%# IIf ( Container.ItemIndex Mod 2 <> 0, "Odd", "Even")%>

Open in new window

0
 
LVL 1

Assisted Solution

by:rerard
rerard earned 100 total points
ID: 36523997
Use mod, check this out:

http://msdn.microsoft.com/en-us/library/se0w9esz(v=vs.80).aspx

So if you do ItemIndex mod 2 it will return 0 for event, 1 for odd.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question