We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

changing value of sorted field overwrites data in other rows!

I have a table that is represented in a datagrid. The datagrid is read-only, but the detail of the table is reflected in controls underneath, which are editable (see attached screen shot). The problem occurs when the user is sorting by a particular column (RequestUser, for example) and then they change the value of the field, causing the position of the row to change due to the sort. This changes fields in rows whose position changed due to the reorder. I've tried removing the sort first, finding the row, changing the value and then reapplying the sort and then finding the row again, which works most of the time -- but when it doesn't work it still overwrites data, in addition to being extremely unwieldy code. Please, any suggestions?

1 Reply

SA Sameer June 24, 2003 02:15 PM UTC

Lori, Could u post the code ur using to update ur data set. I dont think the problem is with sorting or any such, the thing u should try doing is update the datarow, by indexing the dataview. DataRow dr = [urtable].DefaultView[currRowOnBlotter].Row ; and then update this row in the dataset. Hope this helps. -S > I have a table that is represented in a datagrid. The datagrid is read-only, but the detail of the table is reflected in controls underneath, which are editable (see attached screen shot). > > The problem occurs when the user is sorting by a particular column (RequestUser, for example) and then they change the value of the field, causing the position of the row to change due to the sort. This changes fields in rows whose position changed due to the reorder. > > I've tried removing the sort first, finding the row, changing the value and then reapplying the sort and then finding the row again, which works most of the time -- but when it doesn't work it still overwrites data, in addition to being extremely unwieldy code. > > Please, any suggestions?

Loader.
Live Chat Icon For mobile
Up arrow icon