Razor - add class during first instance of a loop

May 6, 2015 at 8:57 PM
I need to add a class of "in" to the first instance only of a div that appears in my list template's foreach loop.

Example:
<div class="item in">
First item in list
</div>

<div class="item">
Second item in list
</div>

<div class="item">
Third item in list
</div>
The actual template for the list is much more complex, so I really want to be able to wrap an if-else statement with an index variable around just the opening div tag, and let the div be closed later in the template. But that doesn't work when I try it.

Is there an easier way?
May 6, 2015 at 9:07 PM
Hi Amanda

Looks like you are looking to create a bootstrap accordeon, here is another thread that discusses it

https://sexycontent.codeplex.com/discussions/568097

also i have a sample app with bootstrap tabs, accordeon and carousel, you can find that here

https://drive.google.com/file/d/0BxsvIrcjHaXEUXVEZnBidlhlUFk/view

Armand 2DNN
Your friendly non official 2sxc support :)