?
Solved

VB ASP.NET: If Odd / Even

Posted on 2011-09-12
2
Medium Priority
?
456 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
[X]
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
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1600 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

777 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