How can you work with programmatic Datatables in Gridviews to allow for editing and deleting of columns and rows.
Posted on 2007-04-04
I have a situation where I have programmatically created a temporary Datatable that is persistent in memory while the data is manipulated...rows are added...and values of columns can be edited..as well as rows being deleted from this table via the gridview.
Once the user is finished manipulating the data they click a button and everything writes to the database into the appropriate tables.
Well at least that is the functionality I need..
I have the Datatable and am currently using the Session to store the object temporarily while the user manipulates the data...
I can even bind the table to the gridview so that the data is displayed.
WHat I cant figure out is how to configure the gridview to allow me to edit the data in the rows and delete rows...normally if the table was created with a dataset I could just set an object datasource to the TableAdapter business object in the dataset and then if I bind the gridview to the ObjectDatasource I get all kinds of optionds to allow me to edit delte etc etc. and its easy to convert the fields to templates...
But how can you do this when your datatable is temporary and built programmatically?
I dont really want to have to be reading and writing and deleting from the database for this but I suppose if I hae to I have to...