Monday, November 1, 2010

INSERT THE AUTO INCREMENTED COLUMN IN GRIDVIEW

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
        <Columns>
            <asp:TemplateField HeaderText="AUTOINCREMENT FIELD">
<ItemTemplate>
                <asp:Label ID="Label1" runat="server"><%# Container.DataItemIndex + 1 %></asp:Label></ItemTemplate>
</asp:TemplateField>
            </Columns>
        </asp:GridView>



USE the DataItemIndex Property

0 comments:

Post a Comment