LLBLGen Pro Datasource binding issue

Posts   
 
    
Coderoid
User
Posts: 7
Joined: 03-Apr-2008
# Posted on: 21-Apr-2008 12:30:31   

Hi guys,

I have a LLBLGenProDatasource that is bound to a dropdownlist, and for the datasource i switched to design view and created two event handlers in VS2005. The idea is to create filters to limit the records returned to bind to my dropdownlist. Unfortunately, when i run the page i do not hit the breakpoints inside both event handlers. What could the issue be?

Here is the code:

protected void LLBLGenProDataSourceAdvertisers_PerformGetDbCount(object sender, PerformGetDbCountEventArgs e)
{
    IPredicateExpression filter = new PredicateExpression();
    if (filter.Count > 0)
    {
        filter.AddWithAnd(new FieldLikePredicate(AdvertiserFields.IsActive, "%" + 0 +  "%"));
    }
    else
    {
        filter.Add(new FieldLikePredicate(AdvertiserFields.IsActive, "%" + 0 + "%"));
    }
}

and

protected void LLBLGenProDataSourceAdvertisers_PerformSelect(object sender, PerformSelectEventArgs e)
{
    IPredicateExpression filter = new PredicateExpression();
    if (filter.Count > 0)
    {
        filter.AddWithAnd(new FieldLikePredicate(AdvertiserFields.IsActive, "%" + 0 + "%"));
    }
    else
    {
        filter.Add(new FieldLikePredicate(AdvertiserFields.IsActive, "%" + 0 + "%"));
    }
}

This is LLBLGenPro v2.5 using Selfservicing mode and .NET 2.0 on Win XP Pro SP2, and Visual Studio 2005 Team System SP1.

Thanks,

Sithembewena Lloyd Dube

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 21-Apr-2008 18:07:16   

Hi Lloyd,

  1. Make sure that yourLLBLGenProDataSource.LivePersistence = false
  2. You have to make the fetch at your handlers. Please read this examples at the help: _LLBLGenPro Help -> Using the generated code -> SelfServicing -> Databinding at designtime and runtime -> Databinding with ASP.NET 2.0 -> Usage examples -> Example using Perform Event handlers. _ Tip: If you are only modifying the filter, you could do that outside the handlers (Page_Load, for instance), then you leave _LLBLProDataSource.LivePersistance = true _and don't need to handle those events.
Coderoid
User
Posts: 7
Joined: 03-Apr-2008
# Posted on: 22-Apr-2008 16:06:40   

Hi goose,

Thanks for the help...the problem had to do with Live Persistence. I will keep your advice in mind as i proceed.

Much respect,

Lloyd Dube