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

Force commit cells value

I'm using the GridControl to display and modify data, with no data bound.
Suppose I have a row with a textbox and a checkbox, if I write something in the textbox (or I check the checkbox)  and I move away from the edited cell (I change column or row), everything is fine and that value is set as CellValue, but if I stay on that cell after editing (no row/column change) the property CellValue results empty and not with the value typed/checked.
My users wants to:
1) write something in the text box, 
1b) eventually move on the checkbox cell and check the checkbox 
2) press a button outside the grid and use the value that they have set in the grid cells

Now, the last value set will be lost if they do not move away from the edited cell (in the example shown in the picture attached, after pressing the button, the value of the checkbox cell "Attivo" is not set).
Is there a way to achieve this behavior?
Thank you
    Luca

Attachment: SS_b370bb2b.zip

3 Replies

KB Kanimozhi Bharathi Syncfusion Team May 29, 2014 10:07 AM UTC

Hi Luca,

 

Thank you for using Syncfusion Products.

 

We have analyzed your query. You can get the value of the cell while it is in edit mode by using ControlValue of CurrentCell Renderer like in the following code snippet

 

Code Snippet:

void button1_Click(object sender, RoutedEventArgs e)

{

    if (gridControl.CurrentCell.IsEditing)

      {

         var value = gridControl.CurrentCell.Renderer.ControlValue;

      }

    else

      {

         var row = gridControl.CurrentCell.RowIndex;

         var col = gridControl.CurrentCell.ColumnIndex;

         var value = gridControl.Model[row, col].CellValue;

      }

                      

}

 

Please let us know if you need any further assistance.

 

Thanks

Kanimozhi B


LC Luca Cavicchioli May 29, 2014 03:33 PM UTC

Thank you for the answer. It works exactly as expected!
Another question, is it possible to achieve the same behavior with the GridDataControl? (I miss the CurrentCell in GridDataControl)
Thank you, regards
    Luca


KB Kanimozhi Bharathi Syncfusion Team June 5, 2014 10:42 AM UTC

Hi Luca,

 

Apologize for the delay.

 

You can get CurrentCell in GridDataControl from the CurrencyManager of Model like the below code snippet.

 

 

var cell = griddatacontrol.Model.CurrencyManager.CurrentCell

 

Please let us know if you need any further assistance.

 

Thanks

Kanimozhi B


Loader.
Up arrow icon