Hi Iam very new to Infragistics and am using ultra win grid with child rows also.So when i click on one of the child rows, my application pops up a dialog box (with save, cancel and close button) with populated details of the clicked row and also provision to modify data. Now if i modify and save the data, it is working great. But when i close the pop up with "X" (close button), it pops up a confirmation saying, "Do you want to save the changes?".If yes it should save, or else it should restore the old values.....Now when i say no, its still saving... even though i had used the DialogResult.No, it is saving the changes.Infact before before clicking the NO button itself it is saving the changes)And for the information I am using ultraGridRowEditTemplate.
You might want to check out the UpdateMode property on the grid.DisplayLayout. By default, the grid commits the changes to the underlying data source when it loses focus. So that's probably what's happening here.
So you may want to do your validation in the BeforeRowUpdate event of the grid.
Or, you may want to change the UpdateMode to something that does not include the grid losing focus - and then you will have to manually handle when the grid commits the changes by calling grid.UpdateData.
Hello Mike,
Thanks very much for the reply, it really helped, however, I encountered a new issue with this.
Basically when one of the rows in the ultrawingrid is clicked, the pop up appears, which is a ultraGridRowEditTemplate with ok, cancel and close buttons.
Ok – saves the changed values
Cancel - resets the values
Close Button - Asks for confirmation with yes or no.
Now my code looks like this:
private bool _isWinCloseButtonClicked;
I am updating this flag _isCloseButtonClicked to false, saying close button is not clicked in both btnTemplateOk_Click and btnTemplateCancel_Click.
ultraGridRowEditTemplate1_Leave(object sender, EventArgs e)
{
If(isCloseButtonClicked)
// Checking the dialog result here
If(yes)
}
Else
no
ultraGrid1_BeforeRowUpdate(object sender, CancelableRowEventArgs e)
e.Cancel = true; }
Now the new issue is when close button is clicked I am not able to change the isCloseButtonClicked to true, it is not firing any event and hence when the yes button from the confirmation is clicked, it is not updating the new value. How can I handle this issue………..?
I'm not sure you can. This is nothing specific to the RowEditTemplate. This dialog is just a Form like any other and it behaves the same way. I don't think there's any way to tell why a form is being closed, unless maybe the Form_Closing event gives you some more information.
Couldn't you just default your flag to true and only set it to false when one of the buttons is clicked?