With Paging
ASPX page
<asp:GridView ID="GridInvoice" OnPageIndexChanging="GridInvoice_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="S.No." ItemStyle-Width="20">
<ItemTemplate>
<%#(grdCourseDetails.PageSize * grdCourseDetails.PageIndex) + (Container.DisplayIndex + 1)%>
</ItemTemplate>
</columns>
</asp:gridview>
aspx.CS file
protected void grdCourseDetails_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdCourseDetails.PageIndex = e.NewPageIndex;
GetCourseDetailsWithPaging(Convert.ToInt16(Lbl_Course_Div_Status.Text), e.NewPageIndex, 10);
}
Without Paging
ASPX page
<asp:GridView ID="GridInvoice" >
<Columns>
<asp:TemplateField HeaderText="S.No." ItemStyle-Width="20">
<ItemTemplate>
<%#(Container.DataItemIndex + 1)%>
</ItemTemplate>
</columns>
</asp:gridview>
No comments:
Post a Comment