Link to home
Start Free TrialLog in
Avatar of Bob Hoffman
Bob HoffmanFlag for United States of America

asked on

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

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") %>'
Avatar of Chad Smith
Chad Smith
Flag of United States of America image

class='<%# Container.ItemIndex % 2 = 0 ? "repeaterOddRow":"repeaterEvenRow") %>'
ASKER CERTIFIED SOLUTION
Avatar of Chad Smith
Chad Smith
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Hoffman

ASKER

added a left parenthesis before "Container".... work great! Thanks knight00

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