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
1615
ultragrid edit mode and update data
posted

I am using an Ultragrid version 10.3 and have a datasource bound to the grid. I have it set to .update the data on afterrowupdate event. What I cannot figure out is when I edit a row, the row header shows the pencil icon and what I want to have happen is when I click on the row header it takes the row out of edit mode and saves the data (similar to an Access grid). I cannot find an Event that does this. Only way I get the afterrowupdate or beforerowupdate events to fire is when I either select a different row (if there is one) or select a different control on the form. Can I do this by clicking the row header?

Parents
  • 20872
    Offline posted

    Hello jcom39201,

    The easiest way to achieve what you are looking for here would be if you set the UpdateMode of the UltraGrid to OnCellChangedOrLostFocus.

    If you rely on the your current settings there is still a way to achieve what you are looking for. Create a bool flag in your application, set it to true or false regards of the current mouse position and if you are currently over a rowSelector your could update the ActiveUltraGridRow on UltraGrid click event. Please take a look at the code snippet below:

     bool isRowSelector = false;
            private void ultraGrid1_Click(object sender, EventArgs e)
             {
                 if (isRowSelector)
                 {
                     UltraGrid ug = sender as UltraGrid;
                     ug.ActiveRow.Update();
                 }
             }
            private void ultraGrid1_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)
             {
                 if (e.Element is RowSelectorUIElement)
                 {
                     isRowSelector = true;
                 }
             }

             private void ultraGrid1_MouseLeaveElement(object sender, Infragistics.Win.UIElementEventArgs e)
             {
                 if (isRowSelector)
                 {
                     isRowSelector = false;
                 }
             }

    Please feel free to to let us know if you need any further assistance.

Reply Children