Paging, DataGrid, Forward only Data Connection

R

RelaxoRy

sqlConnection1.Open();
myReader = sqlCommand1.ExecuteReader();
DataGrid1.DataSource = myReader;
DataGrid1.DataBind();
myReader.Close();
sqlConnection1.Close();

The Datagrid populates fine. I'm styling it on the HTML page. I
configure the DataGrid for paging through the property builder fine.
I AllowCustomePaging=true;. The page loads fine but it only shows "1"
on the page row and I have allowed for 10. Can paging be used on a
read only/forward control? Is this because it populates the control
once with data and there is no cache? Do I have to create a DataSet,
populate it with myCommand, and then bind the DataGrid to that DataSet
in order to allow for caching?

Any info appreciated.

Ryan
 
S

shrini

If you allow custom paging, then you have to implement the paging yourself,
the datagrid will not create the paging. If you want to see all the pages,
set AllowCustomPaging to false, or implement your own paging mechanism. In
this case i think you ar looking for the former one.

shrini
 
R

relaxory

In making AllowCustomPaging to be false, I get this error :

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

So this does mean I cannot use a forward-only read connection to
populate a DataGrid with paging, unless I populate each individual page
on the fly? ie. 1-10, 10-20, 20-30 as different connection states?

So anyway I add the lines :

DataGrid1.AllowCustomPaging=true;
DataGrid1.VirtualItemCount=100;

I get the DataGrid populated and the number 1-8 showing up. When I
click on these numbers nothing happen. The data stays the same. I
guess I have to manually configure the paging to retrieve the records
using an index?
 

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

Top