Datagrid Paging?

Results 1 to 3 of 3

Thread: Datagrid Paging?

  1. #1
    Join Date
    Dec 1969

    Default Datagrid Paging?

    I get the following error when I&#039;m binding my datagrid:<BR><BR>AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID dgMain when AllowPaging is set to true and the selected datasource does not implement ICollection. <BR><BR>Here is the code for my datagrid:<BR><BR>&#060;asp:DataGrid ID="dgMain" <BR> AllowSorting="True" <BR> Runat="server" <BR> OnSortCommand="Sort" <BR> HeaderStyle-CssClass="boxHeadline" <BR> HeaderStyle-BackColor="Cornsilk" <BR> HeaderStyle-HorizontalAlign="Center" <BR> AlternatingItemStyle-BackColor="Beige"<BR> AllowPaging=True<BR> OnPageIndexChanged="PageIndexChanged"<BR> PagerStyle-Mode=NextPrev<BR> PageSize=1<BR> &#062;&#060;/asp:DataGrid&#062;<BR><BR>The data source is assigned programmatically. It is a sql data reader executing a simple select statement. Anyone run into this problem? I guess I should also note that I programmatically generate to bound columns to the data grid.

  2. #2
    Join Date
    Dec 1969

    Default RE: Datagrid Paging?

    The SqlDataReader does not implement the ICollection. Try binding the datagrid with the DataTable or Dataset.<BR>If you still wanna do the binding with sqldatareader you need to set the AllowCustomPaging to True and set the virtualItemCount. I think you need to write the logic for the paging also.<BR>Check the msdn with AllowCustomPaging and you will find an example over there.<BR><BR>HTH

  3. #3
    Join Date
    Dec 1969

    Default For more on custom DataGrid paging...

    Check out this article:<BR><BR>Implement Custom Paging in the ASP.Net Datagrid Control...<BR><BR><BR>hth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts