|
Displaying Row Numbers in a DataGridAverage Rating: 3.4/5 | Rate this item | 25 users have rated this item.
|
Expertise: Intermediate
Language: ASP.NET
September 25, 2009
Displaying Row Numbers in a DataGrid
To display row numbers in an ASP.NET DataGrid, first create a template column and set its ItemTemplate value using the following code:
<asp:templatecolumn headertext="Row Number">
<itemtemplate>
<span><%# Container.ItemIndex+1 %></span>
</itemtemplate>
</asp:templatecolumn>
Srinath MS
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
|