Solved

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

Posted on 2011-02-14
3
389 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
  • 2
3 Comments
 
LVL 10

Expert Comment

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

Accepted Solution

by:
Chad Smith earned 500 total points
Comment Utility
Sorry missed the extra =

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

Author Closing Comment

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

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now