Tuesday, February 8, 2011

Add a Row Number to the GridView

Here’s a simple way to add a Row Number to the GridView. Just add the following tags to your section of your GridView

< Columns>
< asp:TemplateField HeaderText="RowNumber">
< ItemTemplate>
<%# Container.DataItemIndex + 1 %>
< /ItemTemplate>
< /asp:TemplateField>
...
< /Columns>

and you will get the following output

No comments:

Post a Comment

Ajax CalendarExtender displaying at wrong position in Chrome

< script type ="text/javascript" language ="javascript">     function onCalendarShown(sender, args)...