Completely Free .NET word API

Resources » Code Snippets » ASP.NET GridView

Auto Generate Serial Number In Gridview

Updated: Category: ASP.NET GridView
Author: Member Level: GoldPoints: 10

The Given code auto generate serial number with page index changing.

protected void dgSummary_RowDataBound(object sender, GridViewRowEventArgs e)


if (e.Row.RowType == DataControlRowType.DataRow)

GridView gv = sender as GridView;
Label lblSNO = e.Row.FindControl("SLNO") as Label;
int pagedRowNum = gv.PageIndex * gv.PageSize + rowSNO;
e.Row.Cells[3].Text = pagedRowNum.ToString();


catch (Exception ex)
{ }

Did you like this resource? Share it with your friends and show your love!

Responses to "Auto Generate Serial Number In Gridview"

No responses found. Be the first to respond...


Post Comment:

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index
    Subscribe to Subscribers
    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India