Bind Dynamic TypedList to LLBLGenProDataSource

Posts   
 
    
ToryBoy
User
Posts: 2
Joined: 23-Nov-2006
# Posted on: 23-Nov-2006 16:59:12   

Hi,

Here is the Simple version - I’m wondering if its possible to create a dynamic typed list programmatically and bind it to the LLBLGenProDataSource object..

Here is the scenario..

I have an asp.net search page with checkboxes related to various column names, and a search related textbox. When the form is submitted, I build a dynamic typed list by creating a ResultsetFields collection based on the column name tickboxes selected. The ResultsetFields is passed to a TypedListDAO which is used to populate a dataset. This dataset populates an asp:GridView control.

However when it comes to paging I start getting potential issues. I don’t really want to be retrieving a full list every time I page through the results, but just retrieve 10 records per grid page. If I pass a page index and page size into my GetMultiAsDataSet method, this returns only 10 records into the dataset but then the asp:Gridview doesn’t recognise that there are more records in the database and doesn’t show the paging links.

What I would ideally like to be able to do is make the TypedListDAO as the datasource of an LLBLGenProDataSource and point that at the asp:GridView control. This is because (im my limited understanding of things) the paging method used by the LLBLGenProDataSource pages using the ROW_NUMBER functionality (sql server 2005) and retrieves X records at a time. As far as I can see, its only possible to use EntityCollections or TypedLists as the datasource for an LLBLGenProDataSource.

So...Any help or advice on which way to proceed would be greatly appreciated..

I'm using LLBLGen v2 Final (SelfServicing) and SQL SERVER 2005 and VS2005 and AspNet2.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 24-Nov-2006 02:47:39   

I'm not sure of a way to use a dynamic list with a LLBLGenProDataSource, but you can implement your own custom paging. This article mentions a bit about it. If there is a way to make this work better I'm sure someone will post it. http://msdn2.microsoft.com/en-us/library/5aw1xfh3.aspx

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 24-Nov-2006 10:32:52   

The llblgen pro datasourcecontrols don't accept a dyn list so you can't use a datasourcecontrol to bind a dyn. list. You also don't really have to as the data is readonly anyway, so you don't need 2-way databinding, the reason why the datasource controls are created.

As a dyn. list has to be setup in code anyway, you have to write code no matter what so declarative programming (also a reason why datasourcecontrols are used) isn't possible.

So you can just create the dyn. list in the code behind (or other class) and use the LLBLGen Pro paging code to do the paging (i.e. pass the page number/pagesize to the fetch method).

Frans Bouma | Lead developer LLBLGen Pro