Hi all,
I am using PageIndexChanging
event for handling GridView paging in C#. But don't know how can to use PageSize/PageNumber/PageCount there. In other word my code is forced to return all data always. Note following code:
protected void grdList_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdList.PageIndex = e.NewPageIndex;
grdList.DataSource = MyGetData();
grdList.DataBind();
}
Now how can I use real paging in this code?
Notice that MyGetData
has an overload that get PageIndex
and PageSize
too.
UPDATE
I have set PageSize
and enabled AllowPaging
too. I know if I use declarative data binding I should supply GridView with count of all data. Question is how can can use count in this method.
UPDATE 2 It seems that such a thing I need is not possible, refer to http://stackoverflow.com/questions/2518968/problem-with-efficient-gridview-paging-without-datasource-control