Pagination error
Hi
In my form there are four datagrids,i have added paging to all those datagrids and displaying 4 records in one page.
But getting error:
"AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID DataGrid2 when AllowPaging is set to true and the selected datasource does not implement ICollection. "
In aspx file i have set the properties of datagrid as
<asp:datagrid id="DataGrid2" Runat="Server" width="100%" autogeneratecolumns="False" cellpadding="5" cellspacing="0" showheader="True" borderwidth="2px" gridlines="Both" bordercolor="#FFFFFF" AllowPaging="True" PageSize="4">
and in code behind after initialising that event i have written
private void DataGrid2_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
{
DataGrid2.CurrentPageIndex = e.NewPageIndex;
}
Anyone can solve this problem, why this error is coming?
|