Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need to convert this code to work in C# ASP.Net

Posted on 2011-02-14
3
Medium Priority
?
411 Views
Last Modified: 2012-05-11
I've used this line of code in my vb.net asp sites to alternate row styles in a table generated by a repeater. I'd like to use it in my C# asp sites but I can't seem to get the syntax correct. Does anyone know the correct syntax? Thanks

class='<%# IIf(Container.ItemIndex Mod 2 = 0, "repeaterOddRow", "repeaterEvenRow") %>'
0
Comment
Question by:Bob Hoffman
[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
3 Comments
 
LVL 10

Expert Comment

by:Chad Smith
ID: 34892594
class='<%# Container.ItemIndex % 2 = 0 ? "repeaterOddRow":"repeaterEvenRow") %>'
0
 
LVL 10

Accepted Solution

by:
Chad Smith earned 2000 total points
ID: 34892597
Sorry missed the extra =

class='<%# Container.ItemIndex % 2 == 0 ? "repeaterOddRow":"repeaterEvenRow") %>'
0
 
LVL 8

Author Closing Comment

by:Bob Hoffman
ID: 34893285
added a left parenthesis before "Container".... work great! Thanks knight00

class='<%# (Container.ItemIndex % 2 == 0 ? "repeaterOddRow":"repeaterEvenRow") %>'
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

730 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