How can I Programmatically Trigger CslaDataSource Events (Like Update, Insert)?

How can I Programmatically Trigger CslaDataSource Events (Like Update, Insert)?

Old forum URL: forums.lhotka.net/forums/t/953.aspx


Jav posted on Saturday, August 19, 2006

ASP.Net 2.0

I have one FormView and two GridViews on a Wizard Step for entry of Person info, addresses and Phones Respectively.  All use CslaDataSources. Address and Phone GridViews have EditTemplates to edit and Update each row - and it does not appear odd. 

For the Person Info in the FormView, however, I would rather not add an Update CommandButton.  It seems neater to trigger a FormView Update event when the user clicks the Next button in the Wizard.

I can't seem to find a way to do that.  Would appreciate a hint or two. Thanks

Jav

RockfordLhotka replied on Saturday, August 19, 2006

You don't trigger those events directly. Instead, you invalidate the controls that display the data, and those controls will ask data binding for data, and that will trigger the events on the data source control.

The same is true for inserts/updates/etc. You need to interact with the UI control to get it to trigger the desired data binding process.

Jav replied on Saturday, August 19, 2006

Thanks Rocky.  In my particular situation, I also found that FormView has both an InsertItem() method and an UpdateItem() method.  Calling them raises the appropriate event. 

Jav

S1nF0ny replied on Wednesday, August 30, 2006

RockfordLhotka:
You don't trigger those events directly. Instead, you invalidate the controls that display the data, and those controls will ask data binding for data, and that will trigger the events on the data source control.

The same is true for inserts/updates/etc. You need to interact with the UI control to get it to trigger the desired data binding process.


I have a similar issue.  I have an asp.net FormView with a CslaDataSource and cannot get the OnUpdateObject event to fire.  I do not have this issue with DetailsView control. 

How would I "invalidate the controls that display the data" therefore triggering the OnUpdateObject event?  Or have I misunderstood the process?

Jav replied on Wednesday, August 30, 2006

FormView has InsertItem and UpdateItem methods.  Calling them will trigger the corresponding events on CslaDataSource.  Similarly, GridView has UpdateRow method.

Jav

Copyright (c) Marimer LLC