Firing PerformWork from code

Posts   
 
    
Koolworld
User
Posts: 50
Joined: 10-Oct-2006
# Posted on: 12-Apr-2007 18:50:19   

Hi, is it possible to fire the PerformWork for a datasouce programmatically? The reason i ask is i have a datasource on a FormView control, there are several buttons which are set to use the Update Command so they fire the PerformWork which is fine. I want to fire some code before the PerformWork sub runs depending on the button they click. Do the arguments passed to the PerformWork sub contain anything about the way it was fired - i.e. which button, etc?

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 13-Apr-2007 14:06:29   

I think you can try to call the FormView.UpdateItem() , InsertItem() & DeleteItem() From your custom buttons handlers.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39926
Joined: 17-Aug-2003
# Posted on: 13-Apr-2007 18:53:58   

The eventarg parameters contain the elements as known by the datasource control, so the collection, filter etc. not which button is clicked.

What I'd do is setting a var to an enum value when a given button is clicked and when PerformWork comes, INSIDE the perform work read the var and based on the value call your custom routine, and then proceed with the normal perform work code.

Frans Bouma | Lead developer LLBLGen Pro
Koolworld
User
Posts: 50
Joined: 10-Oct-2006
# Posted on: 13-Apr-2007 18:57:32   

Thanks guys for the info, have got it working well now.

Cheers.