I’m using the following code to output entries from my database:
while(reader.Read())
{
Label1.Text += "<div>" + reader["Title"] + "</div>";
}
However, I’d like for every 2nd entry for a “class” to be added to my div.
So ultimately, my HTML could look like:
<div>Title1</div>
<div class="two">Title2</div>
<div>Title3</div>
<div class="two">Title4</div>
...
Many thanks for any pointers.
Something like this should work.
Just have a counter, and for every odd number change
<div>to<div class="two">