Does anyone know why I would be getting the following error when I set
the AllowPaging propery to True on my Datagrid (dgResults)? I have tried
to set it up like I have seen in several examples but I countinue to get
the following error:

AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid
with ID dgResults when AllowPaging is set to true and the selected datasource
does not implement ICollection.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Web.HttpException: AllowCustomPaging must be true
and VirtualItemCount must be set for a DataGrid with ID dgResults when AllowPaging
is set to true and the selected datasource does not implement ICollection.

You either have to use a DataSet, or set AllowCustomPaging to True on your
DataGrid and build your own paging.

"Kerry" <kelleyk@somc.org> wrote in message
news:3ef1b63f$1@tnews.web.devx.com...
>
> Hello,
>
> Does anyone know why I would be getting the following error when I set
> the AllowPaging propery to True on my Datagrid (dgResults)? I have tried
> to set it up like I have seen in several examples but I countinue to get
> the following error:
>
> AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid
> with ID dgResults when AllowPaging is set to true and the selected
datasource
> does not implement ICollection.
>
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
about
> the error and where it originated in the code.
>
> Exception Details: System.Web.HttpException: AllowCustomPaging must be
true
> and VirtualItemCount must be set for a DataGrid with ID dgResults when
AllowPaging
> is set to true and the selected datasource does not implement ICollection.
>
> Source Error:
>
>
> Line 114: ' display results in a Datagrid on the form.
> Line 115: dgResults.DataSource = dr
> Line 116: dgResults.DataBind()
> Line 117: lblPageCount.Visible = True
> Line 118: lblPageCount.Text = "Page " &
(dgResults.CurrentPageIndex
> + 1) & " of " & (dgResults.PageCount)
>
> Any help would be much appreciated. Thanks,
>
> Kerry
> kelleyk@somc.org

06-23-2003, 02:35 PM

Kerry

Re: Error when setting AllowPaging to True on Datagrid

Thanks David,
I just changed it to use a dataset and it is working now. Thanks again.

Kerry

"David Rothgery" <drothgery@alum.wpi.edu> wrote:
>DataReaders don't implement the ICollection interface, which the built-in
>paging functionality for DataGrids uses.
>
>You either have to use a DataSet, or set AllowCustomPaging to True on your
>DataGrid and build your own paging.
>
>"Kerry" <kelleyk@somc.org> wrote in message
>news:3ef1b63f$1@tnews.web.devx.com...
>>
>> Hello,
>>
>> Does anyone know why I would be getting the following error when I set
>> the AllowPaging propery to True on my Datagrid (dgResults)? I have tried
>> to set it up like I have seen in several examples but I countinue to get
>> the following error:
>>
>> AllowCustomPaging must be true and VirtualItemCount must be set for a
>DataGrid
>> with ID dgResults when AllowPaging is set to true and the selected
>datasource
>> does not implement ICollection.
>>
>> Description: An unhandled exception occurred during the execution of the
>> current web request. Please review the stack trace for more information
>about
>> the error and where it originated in the code.
>>
>> Exception Details: System.Web.HttpException: AllowCustomPaging must be
>true
>> and VirtualItemCount must be set for a DataGrid with ID dgResults when
>AllowPaging
>> is set to true and the selected datasource does not implement ICollection.
>>
>> Source Error:
>>
>>
>> Line 114: ' display results in a Datagrid on the form.
>> Line 115: dgResults.DataSource = dr
>> Line 116: dgResults.DataBind()
>> Line 117: lblPageCount.Visible = True
>> Line 118: lblPageCount.Text = "Page " &
>(dgResults.CurrentPageIndex
>> + 1) & " of " & (dgResults.PageCount)
>>
>> Any help would be much appreciated. Thanks,
>>
>> Kerry
>> kelleyk@somc.org
>

07-11-2007, 10:23 AM

Xana_LYoko

dgResults error

Does anyone know why I get this error when using dgResults:

Compiler Error Message: CS0103: The name 'dgResults' does not exist in the current context