Resources » Code Snippets » ASP.NET GridView

Auto Generate Serial Number In Gridview


Posted Date: 19-Dec-2007  Last Updated:   Category: ASP.NET GridView    
Author: Member Level: Gold    Points: 10






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


protected void dgSummary_RowDataBound(object sender, GridViewRowEventArgs e)
{

try
{

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

GridView gv = sender as GridView;
Label lblSNO = e.Row.FindControl("SLNO") as Label;
rowSNO++;
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...

Feedbacks      

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
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    kush
    More...
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India