CSLA Datasource

CSLA Datasource

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


remithr posted on Monday, November 12, 2007

Hi,
How can I manually update a CSLA Datasource, may through a button click.


Normally, the CSLA datasource is updated through SelectObject, InsertObject, DeleteObject and UpdateObject events and then GridView is updated. I would like to update the CSLA datasource through a button click.


e.g. I have a search criteria on the webform and would like to display the search results in the GridView below on the search button click.


Thanks

 

RockfordLhotka replied on Monday, November 12, 2007

You need to understand how ASP.NET data binding works. The page starts to render, which causes the UI controls to render. If a UI control needs data (because it has none, or someone has called DataBind() on it) then it asks its data source control for data, and the data source control gets the data.

So to "refresh a data source control" you really need to call DataBind() on the UI control that gets data from that data source control.

The same is true for update/insert/delete operations. You need to tell the UI control (DetailView, GridView, FormView) to do the insert/update/delete and it will tell data binding, which will tell the data source control, which will raise the event, which allows you to interact with your object, which triggers the data portal, which runs your DataPortal_XZY method, which can talk to the database.

Quite a flow when you look at it all in a row like that! Smile [:)]

remithr replied on Tuesday, November 13, 2007

It works for me now.

Thank you RockfordLhotka, for leading me in the right direction.

 

Regards,

Remith

 

Copyright (c) Marimer LLC