Current entity in a Janus grid

Posts   
 
    
Steve Mann
User
Posts: 31
Joined: 22-Nov-2006
# Posted on: 07-Dec-2006 12:18:13   

LLBLGen Pro v2.0.0.0, Selfservice, Janus Gridex3, VB.NET VS 2005

In the DeletingRecord event of a Janus grid which uses an EntityCollection as its Datasource, I want to access the Entity the user is deleting.

I can use FindMatches using the PK cell. Is there a better way?

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 07-Dec-2006 12:44:57   

Steve wrote:

LLBLGen Pro v2.0.0.0, Selfservice, Janus Gridex3, VB.NET VS 2005

In the DeletingRecord event of a Janus grid which uses an EntityCollection as its Datasource, I want to access the Entity the user is deleting.

I can use FindMatches using the PK cell. Is there a better way?

Hi,

Try the following:

  1. Get the EntityCollection's currencyManager: cm = gridEX.BindingContext(MyEntityCollection)

  2. Get the current selected entity using the cm.position: selectedEntity = MyEntityCollection(cm.position)

  3. Now that you have the selected entity you can get any property.

Steve Mann
User
Posts: 31
Joined: 22-Nov-2006
# Posted on: 07-Dec-2006 13:18:56   

Thanks! sunglasses

I had to use BindingManagerBase:

        Dim bmbAny As BindingManagerBase
        bmbAny = GridEX1.BindingContext(clnAbilty1)
        entAbilty1 = clnAbilty1(bmbAny.Position)

        If entAbilty1.Abil001.Count > 0 Then...

...I can ask the user if they want to delete children, etc, etc.

This just gets better.smile