adding s.n. in webgrid

      var custm = (List<custDis>)TempData["custom"];
    var count=1;    
    var grid = new WebGrid(custm, canPage: true, canSort: true, rowsPerPage: 5,ajaxUpdateContainerId:"grid");

footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
            grid.Column("S.N.", format:@<text>@count </text> ),


I have web grid as above. the webgrid displays name. I want to add s.n. in the web grid how can I do that. I tried to use counter but i don't know where should I increase its value. how can I add the s.n. in above code.


If I understand you, you want to add counter for your webgrid on the view, that can look like this :

grid.Column("S.N.", format:p=>count++)

But if you want to add paging for webgrid this won't work, because every time the counter will set to 1.

Need Your Help

play mms wmv video in android

java android mms

I saw this tutorial

Python: List indexing for loop deletion glitch

python list for-loop indexing del

This is a very tricky problem to explain. I was playing around with Python's list methods, particularly the del index object. I wanted to create a simple script that would create a list of integers...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.