Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JAVASCRIPT
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 :) Latest Articles
 


  

 
add auto increment field to gridview
Classified Posted on 12 Jul 2011

Home >> DotNet >> ASP.NET >> add auto increment field to gridview



First add a bound column to GridView at position 0 in databound field and addevent RowDataBound to the GridView

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  {
   if (e.Row.RowType == DataControlRowType.DataRow)
  {
   e.Row.Cells[0].Text =Convert.ToInt32(e.Row.RowIndex+1).ToString();
  }
}

 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |