开发者

Print out ranks virtually

开发者 https://www.devze.com 2023-04-07 19:45 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号