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");
}



@grid.GetHtml(
tableStyle:"webgrid",
headerStyle:"webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
rowStyle:"webgrid-row-style",
columns:
            grid.Columns(
            grid.Column("S.N.", format:@<text>@count </text> ),
            grid.Column("Name",format:@<text>@item.name</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.

Answers


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 http://ffmpegandroid.blogspot.co.il/2014/06/below-blog-will-explain-steps-to-setup.html

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.