Can you help (editable datagrids)

C

Craig G

Hi,

ive been using the following link :-
http://www.dotnetjohn.com/articles.aspx?articleid=21

but i noticed in the code that it only brought back the top 10 records. when
i removed this and brought back all records and added paging via the
property builder i got the following error

**********************************************************************
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID dtgCustomers 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 dtgCustomers when
AllowPaging is set to true and the selected datasource does not implement
ICollection.

Source Error:

Line 46: objConn.Open()
Line 47: dtgCustomers.DataSource = cmdCustomers.ExecuteReader()
Line 48: dtgCustomers.DataBind()
Line 49: objConn.Close()
Line 50: End Sub

**************************************************************************

im a little bit confused with all this as im a bit of newbie to it all. how
would i get paging to work?

Cheers,
Craig
 
J

John Saunders

Craig G said:
Hi,

ive been using the following link :-
http://www.dotnetjohn.com/articles.aspx?articleid=21

but i noticed in the code that it only brought back the top 10 records.
when
i removed this and brought back all records and added paging via the
property builder i got the following error

**********************************************************************
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID dtgCustomers 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 dtgCustomers when
AllowPaging is set to true and the selected datasource does not implement
ICollection.

Source Error:

Line 46: objConn.Open()
Line 47: dtgCustomers.DataSource = cmdCustomers.ExecuteReader()
Line 48: dtgCustomers.DataBind()
Line 49: objConn.Close()
Line 50: End Sub

**************************************************************************

im a little bit confused with all this as im a bit of newbie to it all.
how
would i get paging to work?

You should look into using a DataSet instead of a DataReader (which you're
getting back from ExecuteReader). I'm afraid I don't have a good link handy,
but you'll find good references on MSDN.

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,588
Members
45,100
Latest member
MelodeeFaj
Top