Hi,
I'm having a few issues i'm unable to resolve and wondered if someone could give me a quick hand.
I've got a main gridview which shows a list of pre-filtered data for each user after they log in. I used to have controls databound so when a row was selected the details would update and when changes were made using those controls and the save button pressed the dataset would update.
Then someone pointed out that if they grouped some of the data and then changed that same criteria using the controls the bindings would go out of sync and when a further record was selected, the incorrect details would be displayed in the controls. (Basically the agents have a list of customers and a column which shows the next call date. When they group by that to show them the customers they have to call that day, they will then change the next call date and that's when things become out of sync; selecting Customer A doesn't display Customer A in the bound controls).
So I suspected this was because the row index was getting out of sync so I went about rewriting the entire process so that when the row changes it now fills those controls with the currentrow value; this works fine.
My problem is now trying to update the dataset with the changes made to that row. I have used the below code (basic example) but it really doesn't look right and isn't saving the information properly.
I have looked at the value for currentrow and if I try to save the first row in my filtered list it is giving me an index of 0. This is updating the row and the first row in my dataset which isn't what I want.
I found something about GridViewRowInfo on here but not sure if it's the correct way to go and then how to implement it in my code.
I would really appreciate any help!
Regards,
Guy
I'm having a few issues i'm unable to resolve and wondered if someone could give me a quick hand.
I've got a main gridview which shows a list of pre-filtered data for each user after they log in. I used to have controls databound so when a row was selected the details would update and when changes were made using those controls and the save button pressed the dataset would update.
Then someone pointed out that if they grouped some of the data and then changed that same criteria using the controls the bindings would go out of sync and when a further record was selected, the incorrect details would be displayed in the controls. (Basically the agents have a list of customers and a column which shows the next call date. When they group by that to show them the customers they have to call that day, they will then change the next call date and that's when things become out of sync; selecting Customer A doesn't display Customer A in the bound controls).
So I suspected this was because the row index was getting out of sync so I went about rewriting the entire process so that when the row changes it now fills those controls with the currentrow value; this works fine.
My problem is now trying to update the dataset with the changes made to that row. I have used the below code (basic example) but it really doesn't look right and isn't saving the information properly.
private
void
SaveAccountDetails()
{
int
currentrow =
this
.radGridView1.Rows.IndexOf(
this
.radGridView1.CurrentRow);
mercuryDBDataSet.Main[currentrow].Notes = AccountNotesTextBox.Text;
radGridView1.CurrentRow.InvalidateRow();
MessageBox.Show(
"Records Updated"
);
}
I have looked at the value for currentrow and if I try to save the first row in my filtered list it is giving me an index of 0. This is updating the row and the first row in my dataset which isn't what I want.
I found something about GridViewRowInfo on here but not sure if it's the correct way to go and then how to implement it in my code.
I would really appreciate any help!
Regards,
Guy