There are certain scenario when we required pagination in gridview
Solution for this is very simple.
In .aspx page
<asp:GridView ID="GvEmployee" runat="server" AllowPaging="True" Width="100%" PageSize="10" OnPageIndexChanging="GvEmployee_PageIndexChanging">
<columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
</columns>
</asp:GridView>
In c# Page
protected void GvEmployee_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
try
{
GvEmployee.PageIndex = e.NewPageIndex;
databind();
}
catch (Exception ex)
{
}
}
Subscribe to:
Post Comments (Atom)
Paging in grid view using C#
ReplyDelete