Disable LLBLGenDatasource on first load

Posts   
 
    
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 02-Jan-2007 19:51:09   

LLBLGen Pro 2.0, adapter scenario

There are times when I would like to delay loading a grid or list control that is attached to an LLBLGen datasource. For example, a datasource that loads a grid as a result of a search. What is the best way to accomplish this?

Joel Reinford Data Management Solutions LLC

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 03-Jan-2007 01:10:41   

I set the visibilty on the grid to false and then set it to true when the search is done.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 03-Jan-2007 09:55:53   

It's indeed a bit problematic, as due to the declarative programming, asp.net just binds the grid to the datasource at page init time (or whatever stage) and this makes the grid simply call the datasource's ExecuteSelect(), which has to produce data.

As it's unknown if the data has to be produced or not, the datasource control simply loads the data and returns it.

To overcome this, you indeed need to hide the grid until you have something to show. Another way is to set a filter which will fail, although this is a bit of a hack.

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 04-Jan-2007 18:17:13   

Make the grid invisible! I was looking for something much harder. stuck_out_tongue_winking_eye

This answer suits me perfectly and it is quite easy to do. I can't believe I didn't think of it.

Joel Reinford Data Management Solutions LLC