Print out ranks virtually
I have done something similar to this in php and cannot figure it out in mvc3. I want to pull the top 100 results from a table and append a number to each result to print it out like a Top Charts type of deal. I want to just add the rank number on the fly.
My Code:
var tracks = db.Query(@"SELECT * FROM track开发者_运维问答s ORDER BY plays DESC LIMIT 100").ToList();
@foreach (var track in tracks) {
var a = 0;
var x = a+1;
<tr>
<td>@x</td>
<td>@track.Title</td>
</tr>
}
What I want it to do (Append the next number in the next one):
<tr><td>1</td><td>Track Name</td></tr>
<tr><td>2</td><td>Track Name2</td></tr>
Nevermind project aborted, since people gotta criticize so hard on people trying to start a new flavor to write. Its all good.
精彩评论