ASP.NET Save entire datagrid to database

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
I'm quite fluent in .NET, but i do hardly ANY ASP.NET Development. In a recent project i've run into a simple task (in winfroms dev) that apparently is not simple in ASP.NET:

Binding a dataset to a datagrid, displaying the grid with template columns, and saving/updating the changes. not to one row, but the entire dataset.

in windows apps this is incredibly easy, as the dataadatper.update command looks at rows with the .haschanges = true and submits the updates. Yet, in ASP.NET the ONLY way ive found is to go ROW by ROW(in the datagrid, not dataset) and update each and every row in the dataset correspondingly, then issue the update command. There HAS to be a better way. What am I missing?
 

torpid

Lifer
Sep 14, 2003
11,631
11
76
Nope, no better way than that. The dataset is lost after the page is rendered. In windows forms the dataset is still around so it's easy for it to map it both ways.

I'm sure you could write some quick code to do this, but again, the dataset will be lost unless you do something to retain it, like put it in session or similar.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
Originally posted by: torpid
Nope, no better way than that. The dataset is lost after the page is rendered. In windows forms the dataset is still around so it's easy for it to map it both ways.

I'm sure you could write some quick code to do this, but again, the dataset will be lost unless you do something to retain it, like put it in session or similar.

Thanks, torpid, i just need a confirmation on that. It makes me wonder why the datagrid object doesnt have a GetDataset() method that returns a dataset with the changed properties. Its such a very common task.