How to get the LLBLGenProDataSource2 do not work when page first load

Posts   
 
    
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 18-Feb-2009 03:14:51   

I want then LLBLGenProDataSource2 do not perfrom a select when the page load first time,that is the Page.IsPostbakc=false.

There are some controls in my page to create a filter for the datasource control.I want the datasource control execute a select action only when I click a "Query" button.When the page load for the first time(not postback),I want the datasource control do nothing. As the mess data in db,if no filter use,the page will load slowly.That's what I not want. Is there such a property for LLBLGenProDataSource2 like "Enable" I can use for

Page_Load() { if(!IsPostBack) { datasource.Enable=false;//Should do nothing } else { //perform a select action } }

And at current,I have to use a absolutely "False" filter such as "1=2" and so on to perform this function.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Feb-2009 03:40:46   

Try this:

if (!IsPostBack)            
{
    LLBLGenProDataSource21.Refetch = false;
}

And when you perform the search (btnSearch_Click, for instance), set it to true.

David Elizondo | LLBLGen Support Team
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 18-Feb-2009 04:37:08   

daelmo wrote:

Try this:

if (!IsPostBack)            
{
    LLBLGenProDataSource21.Refetch = false;
}

And when you perform the search (btnSearch_Click, for instance), set it to true.

NO,it still select all records

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-Feb-2009 09:29:25   

I think as long as it's set to to some controls it will automatically fetch the records once that control is loaded.

So what you can try is to remove this association from the aspx code, and later in code when you want it to fetch the records associate it to the appropriate control's DataSource property, and call DataBind() of the control.