-
Error when setting AllowPaging to True on Datagrid
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
-
Re: Error when setting AllowPaging to True on Datagrid
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
-
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
>
-
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
Source Error:
Line 33: dgResults.DataSource = ds;
Line 34: dgResults.DataBind();
Line 35: }
Thanks,
Xana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks