Casting Custom List / DataTable into TypedList?

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 22-Apr-2007 19:57:58   

For the sake of data binding , I am trying to convert a data table into a typed list.

Basically, here is my code:


dataSource.TypedList = MyClientEntity.FetchAllClientsList

dataSource is a LLBLGenProDataSource2 FetchAllClientsList returns a data table. The data table that is built is built using ResultSetFields and the Adapter.FetchTypedList() method.

In any case, I am overriding the perform select event in my UI and I am trying to set the DataSource.TypedList property == the result of my FetchAllClientsList method.

So, long story short, is there a way to cast a data table as a TypedList for the sake of data binding with the LLBLGenProDataSource2 control?

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Apr-2007 21:37:50   

For the sake of data binding , I am trying to convert a data table into a typed list.

There is no an easy and implicit way to do that. But Why are you trying to do that? What more easy to setup that in your declarative asp.net?

David Elizondo | LLBLGen Support Team
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 22-Apr-2007 22:04:57   

The reason that I am trying to do it is because 1. I am using a llblgen data source control and not an object data source 2. I dont have a typed list or typed view in the generated code that returns the result set that I want

I suppose i will just use an object data source instead, which stinks but it will work, untill I need to databind with paging using a custom list.

Will the next version of the LLBLGenDataSource2 control allow us to bind to datatable? It would come in handy for binding to custom lists.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Apr-2007 04:31:34   

For all the functionality of LLBLGenProDataSource (sync, bind, changetracking, etc.) a valid LLBLGen object is needed. So you can create your custom typedList for this intention.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39922
Joined: 17-Aug-2003
# Posted on: 23-Apr-2007 13:32:12   

Devildog74 wrote:

The reason that I am trying to do it is because 1. I am using a llblgen data source control and not an object data source 2. I dont have a typed list or typed view in the generated code that returns the result set that I want

I suppose i will just use an object data source instead, which stinks but it will work, untill I need to databind with paging using a custom list.

Will the next version of the LLBLGenDataSource2 control allow us to bind to datatable? It would come in handy for binding to custom lists.

To do that, it indeed requires a live object already fetched, as it doesn't contain a typedlist designer of some sort. This thus means that you also could use any databinding scheme, as it simply comes down to binding a datatable to a grid, as the data is readonly anyway.

Frans Bouma | Lead developer LLBLGen Pro