DataGrid Row Headers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to add numbering to the rows in a DataGrid control? I just
want to have 1, 2, 3... show up for each row so the user can see how many
items they've entered.
 
Try something like the following:

<script runat="server" language="c#">
int i = 1;
</script>

<asp:DataGrid id="testgrid" runat="server">
<Columns>
<asp:TemplateColumn headerText="#">
<itemtemplate>
<%# i++ %>
</itemtemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
 
Wow. I guess I should have specified that I was writing a Windows app. I have
no idea what scripting you are using, although I do appreciate the simplicity
of the code and your assistance.

I guess I still have alot to learn. :)
 
Back
Top