Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:45:45+00:00 2026-06-10T11:45:45+00:00

@{ var custm = (List<custDis>)TempData[custom]; var count=1; var grid = new WebGrid(custm, canPage: true,

  • 0
  @{
      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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:45:47+00:00Added an answer on June 10, 2026 at 11:45 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can i use custom attributes with linkbutton? like this: var linkb= new LinkButton(); linkb.ID
I'm new to drupal. Is there any way to list in my custom-node.tpl.php what
I created a list control at runtime as following: var myList:List = new List();
I have List object filled with instances of a custom struct. list.Add(new Mail(mail1, test11,
I have the following code that processes an INotification (custom interface) var mgr =
to custom validate an input i wrote a script: function cardNumberCheck(value, element) { var
For example I want to use custom logger: logger = require('basic-logger'), logger.setLevel('info') var customConfig
var ref1 = new Firebase(http://gamma.firebase.com/myuser/123,456); ref1.set(123,456); var on1 = ref1.on(value, function(snapshot) { console.log(snapshot.val()); });
I've got some problems adding a excel document as attachment on a custom list.
So I have a DataGridView which is used to display a list of custom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.