PagedDataSource related to DataGrid?

P

Per Salmi

We are working on a problem related to a control to use for paging in combination
with either DataGrid controls or PagedDataSource objects used as datasources
for other controls like Repeaters or DataLists.

What is the best way to make our paging control get access to the properties
like CurrentPageIndex and PageCount? And still support both DataGrid and
PagedDataSource?

A DataGrid or DataGrid.DataSource property can not be casted into a PagedDataSource...

Should we use reflection to check for properties like CurrentPageIndex and
PageCount in a generic object passed into my control as a property?

Best regards,
Per Salmi
 
I

imsinc

Why not store it in the ViewState?

ViewState["CurrentPage"] = "1";
ViewState["CurrentSort"] = "CustomerId desc";

Jason Bentley
 
P

Per Salmi

Hello (e-mail address removed),

The problem is not about storing the properties as such. It is more like
we want our pager control to be able to do paging stuff to any other control
that supports the currentPageIndex and the other stuff that is related to
paging. Both DataGrid and PagedDataSource implements these properties but
they are not controls that implement a "paging stuff" interface.

So if we have a page where the devloper throws in some of our pager controls
and a control that should be controlled by the pager controls he/she needs
to wire up an event and implement a handler for "change page" messages that
comes from the pager controls.

Today the pager controls only communicates with a PagedDataSource control,
it can not talk to a DataGrid even if the DataGrid implements the same properties
as the PagedDataSource as the two doesn't have a common interface even if
they in fact have the same properties.

/Per Salmi
 
I

imsinc

Hmmm. I see your dilemma and it is not an easy one. I don't see an easy
solution nor an end-all solution other than creating a separate object
that has interfaces to control the paging of each different other
control. When you discover new controls that require paging, you will
have to add new interfaces. Sorry, that is the only possible solution I
see.

Jason Bentley
http://geekswithblogs.net/jbentley
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top