Filter LLBLGenProDataSource2 before Databinding

Posts   
 
    
staleb
User
Posts: 19
Joined: 30-Jan-2007
# Posted on: 20-Mar-2007 16:44:07   

Hi,

Here is an example of my problem I have a grid in a usercontrol, whenever changes is made to this grid its logged in another table called ApplicationLog. In my grid I have a editbutton on each row, but instead of displaying a editform it displays another usercontrol (inside my original grid) containg a grid which is bound to applicationLog. In short I show this history of each row.

Now here is my problem. I want to filter (add a where clause) to the LBLGenProDataSource2 that the applicationlog grid uses. The value it should be filtered on is a value (pk) that is inside the MainGrid.

Ex: MainGrid ID Name PK 1 Red 2 2 Blue 3

I can do the opperation in the prerender event of the grid, but then it has been already been filled once. And I have to rebind it. This is not the optimal solution. Because this table, applicationlog, will be big in the future.

So how do I filter the LLBLGenProDataSource2 before it binds to the grid? I know I can use selectparameters, if this is the soution, how do I get the selected row value into selectparameters?

(Hope this was understanding)

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 20-Mar-2007 17:39:55   

Hi,

I think using selectparameters is a good idea.

For getting the current row, I think you should use the usercontrol's DataBinding event. I did a similar thing with a datalist recently, and it worked.

Cheers,

Aurélien

staleb
User
Posts: 19
Joined: 30-Jan-2007
# Posted on: 20-Mar-2007 17:56:43   

Hi

Do u have an example on how to get the value an use it the selectparamters? Thats were I got stuck! simple_smile

staleb
User
Posts: 19
Joined: 30-Jan-2007
# Posted on: 21-Mar-2007 14:12:14   

HI I ended up leaving my orginal idea. Insted of binding the grid to a llblgenprodatasource2. I added a NeedDataSource event to my grid, and followd the example in the llblg documentation!

simple_smile