Search This Blog

Friday, August 5, 2011

How to use Container.DataItemIndex?

<asp:GridView ID="gvVendorBillDtl" runat="server" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" Width="100%" CellPadding="2" CellSpacing="0" BorderWidth="1" PageSize="5"
<Columns>

<asp:TemplateField HeaderText="Sr.No.">
<ItemTemplate>
<asp:Label ID="SrNo" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

No comments:

Post a Comment