HOW to use DataGrid for editing purposes?

Posts   
 
    
un.real
User
Posts: 12
Joined: 27-May-2005
# Posted on: 27-May-2005 16:37:59   

Greetings from Turkey;

I am developing a project with C#. I have a webform containing a DataGrid object and I pass my data to the DataGrid using an object of a collectionclass. I set DataGrid.EditItemIndex to DataGrid.SelectedIndex; so when the user selects a line from the DataGrid, it becomes editable.

The problem is: I couldn't find a way to save the changes I made on the Editable DataGrid Fields to my database... How can I make my database aware of the changes I make on my DataGrid?..

Thanks in advance.

Abdullah.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-May-2005 12:13:51   

In asp.net, databinding as in winforms doesn't exist, as there's no actual active page object. (as soon as the page is rendered, everything is cleaned up). So what's done mostly (my understanding, I'm not very familiar with the webgrid and making it edit data) is to keep the objects you use to fill the grid (or bind to the grid) alive in the session and update the entity on the position with the value specified in the grid on the page.

Some 3rd party grids do this for you by keeping the data in teh viewstate.

Frans Bouma | Lead developer LLBLGen Pro