Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1590
Issue with closing form containing ultra grid bound to ultra data source
posted

Hi,All.

My test application describes the problem I have encounter with. (I have attached it )


The application is a form containing an ultra grid bound to an ultra data source.
1. I change data in a cell.
2  Carriage retains in a cell.
3. Then I click on the button 'Close' that has the following code in event handler:
        private void closeBtn_Click(object sender, EventArgs e)
        {
            Close();
        }
4. OnDataSourceCellDataUpdating is fired.
5. Form does not close.(

// In OnDataSourceCellDataUpdating I set e.Cancel in True specially to show that
 form in this case cannot be closed. But I want when an user clicks on 'Close' button Form closes anyway.

 Do you have an idea what the problem could be?
 Thanks in advance.

IssueWithClosingForm.zip
Parents
No Data
Reply
  • 37774
    Suggested Answer
    posted

    The problem here seems to be the fact that your button's event handler is never actually being hit, the reason being that the ActiveCell of the grid is still in edit mode.  When you try to click on the button, the grid must lose focus before a new control can take focus.  As part of this operation, the grid is going to try to commit the change of the cell to the underlying data source; since this operation has failed, the grid doesn't leave edit mode.  You might want to take a different approach, such as delaying committing anything to your database until you know that the user isn't closing the form.

    -Matt

Children