User1429119366 posted
Allow me to share this simple yet useful tip with you all:
protected
int i = 1;
protected
void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType ==
DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = Convert.ToString(GridView1.PageIndex * GridView1.PageSize + i);
i++;
}
}
<asp:TemplateField
HeaderText="Sr. No.">
<ItemTemplate>
<asp:Label
ID="Label1"
runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Hope this helps someone.
Fox