Solved

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

Posted on 2011-02-14
3
398 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
ID: 34892594
class='<%# Container.ItemIndex % 2 = 0 ? "repeaterOddRow":"repeaterEvenRow") %>'
0
 
LVL 10

Accepted Solution

by:
Chad Smith earned 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

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