Reverse Binding of DataGrid

  • Thread starter Robert Roney via .NET 247
  • Start date
R

Robert Roney via .NET 247

I've created a DataGrid full of template columns to allow my userto simultaneously edit any of the rows. Everything functionsfine, until I try to save the data. The issue involved is thatthe DataGrid is based on a Sorted DataView. If the field Iupdate in the DataGrid was part of the sort, the DataViewupdates it's index/sort immediately after each record, thus whenthe record following is reached, the dataview sequence no longermatches the grid sequence. Is there a way of disabling thisre-sorting until I've rebound all the datagrid to thedataview/dataset?

i.e. 1 a, 2 b, 3 c...

If the grid is sorted by letters and you change the 'b' to a 'd',everything saves back fine until you reach the 3rd record. Atthis poing the dataview sequence is 1 a, 3 c, 2 d while thegrid holds 1 a, 2 d, 3 c

I've tried a number of things but have had no luck to date. Anyhelp is appreciated
 
S

Steve Mauldin

Robert,

A Side question. Do you mean you can edit cells in the grid? If so how did
you do the template binding? I am trying to add a textbox to a grid and
bind the grid to a datasource and have the textbox contain and update the
particular field. I get the grid and the textbox shows in the grid but the
data is not present in the textbox or bound to the textbox. If you have a
sample of how you handled textboxs in your grid I would appreciate you
posting it. Thanks.


I've created a DataGrid full of template columns to allow my user to
simultaneously edit any of the rows. Everything functions fine, until I try
to save the data. The issue involved is that the DataGrid is based on a
Sorted DataView. If the field I update in the DataGrid was part of the
sort, the DataView updates it's index/sort immediately after each record,
thus when the record following is reached, the dataview sequence no longer
matches the grid sequence. Is there a way of disabling this re-sorting
until I've rebound all the datagrid to the dataview/dataset?

i.e. 1 a, 2 b, 3 c...

If the grid is sorted by letters and you change the 'b' to a 'd', everything
saves back fine until you reach the 3rd record. At this poing the dataview
sequence is 1 a, 3 c, 2 d while the grid holds 1 a, 2 d, 3 c

I've tried a number of things but have had no luck to date. Any help is
appreciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,129
Latest member
FastBurnketo
Top