Reputation: 3494
Grid View paging not work means it not display record page by page
<data:EntityGridView ID="GridOpen" runat="server" AutoGenerateColumns="false" AllowMultiColumnSorting="false"
DefaultSortDirection="Ascending" AllowPaging="false" PageSize="10" OnPageIndexChanging="GridOpen_PageIndexChanging"
OnSelectedIndexChanged="GridOpen_SelectedIndexChanged" DataKeyNames="OrderNo" Width="100%"
OnRowDataBound="GridOpen_OnRowDataBound" ExcelExportFileName="Export_AccountTerms.xls">
<Columns>
<asp:BoundField DataField="OrderNo" HeaderText="Order No" SortExpression="[OrderNo]" />
</Columns>
This is my data source and Binding the grid
_actOpen = _actOrdServices.GetPaged("StatusID=1 AND AssignedDispatchBoardID = " + DispatchBoard + " AND CompanyId=" + Session["CompanyId"].ToString(), "OrderNo Desc", GridOpen.PageIndex, GridOpen.PageSize, out count);
GridOpen.DataSource = _actOpen;
Also i have try for paging
GridOpen.AllowPaging = true;
my Store procedure is working fine but here i dont know this is not display paging in grid
Any guide will deeply welcome.
Upvotes: 0
Views: 611
Reputation: 3661
In addition to what you have to done, it is also necessary to write the paging event in the aspx.cs:
1) Make sure you have done, allowed paging="true' in the aspx. page( in gridview).
2) Then register the event in the code:
protected void GridOpen_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridOpen.DataSource = YourOBJ.Method_yourmethod();
GridOpen.PageIndex = e.NewPageIndex;
GridOpen.DataBind();
}
Upvotes: 0
Reputation: 3198
First in your aspx code AllowPaging="false" make it "true."
Then in code behind PageIndexChanging event do this,
protected void GridOpen_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridOpen.DataSource = _actOpen;
GridOpen.PageIndex = e.NewPageIndex;
GridOpen.DataBind();
}
Upvotes: 1
Reputation: 111
your allow paging property of the gridview is set to false (AllowPaging="false") make it true and check again.
Upvotes: 0