Asp.Net and PrefetchPath2

Posts   
 
    
braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 21-Jan-2008 19:31:47   

Hi,

i have a page with some databounded controls through LLBLGenDataSource2. I had to pass to the datasource a PrefetchPath2.

Where can i place "myDataSource.PrefetchPatToUse= myPpath2" ? on the Page_Load?

regards Davide

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 21-Jan-2008 22:09:56   

Yeah, the Page_Load is a good place. Remember to surround the expression with an IF block checking for the IsPostBack status.

David Elizondo | LLBLGen Support Team
braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 22-Jan-2008 00:12:23   

daelmo wrote:

Yeah, the Page_Load is a good place. Remember to surround the expression with an IF block checking for the IsPostBack status.

thanks for your reply! if I sorrund it in a if block that cheks for IsPostBask, do the datasource2 reload it at every postback or at every callback?

I ask it, because I got a strange resultset when I use PrefetchPath2 in my Asp.Net page. I have a LLBLGenDataSource2, that has got a Session SelectParameter (live persistence ON) On page load i pass to the DataSource2 a prefetch path.

If load the page WITHOUT passing prefetchpath2, i got the right resultset. If I pass the PrefetchPath2, my DataSource2 builds a query with some SELECT ... IN statement that returns a strange resultset.

Can you provide me a best practice example for Asp.Net that shows how can I use: LLBLGenDataSource2 (live persistence ON), Session SelectParameter (for now i set it via Designer) and PrefetchPath2.

thanks for your patience!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Jan-2008 10:16:13   

if I sorrund it in a if block that cheks for IsPostBask

The check should be if NOT IsPostBack.

Can you provide me a best practice example for Asp.Net that shows how can I use: LLBLGenDataSource2 (live persistence ON), Session SelectParameter (for now i set it via Designer) and PrefetchPath2

Please have a look at the ASP.NET 2.0 databinding example in the download section of the website.

braidiano
User
Posts: 40
Joined: 18-Nov-2006
# Posted on: 22-Jan-2008 10:33:34   

Hi,

I watched the examples, but the PrefetchPaths aren't insiede a !IsPostBack clause...

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Jan-2008 10:57:43   

Yeah you're right, the idea is to avoid re-adding the same preftechPaths more than once to the LLBLGenProDataSource property.

So either you control this by the help of the if Not isPostBack condition or by instantiating the properties.

And in the examples the datasource properties were re-instantiated in the page load everytime to avoid the redundancy.