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
35
ultraGrid1_CellChange event didnot fire
posted

Hi,

I have ultragrid with ultraTextEditor using ultraControlContainerEditor1.

I want to capture the ultraTextEditor text as soon as user type in it, in short every key stroke with in the ultraTextEditor.

I tried to do this using ultraGrid1_CellChange  event , but it is not triggering at all for any cell I change the value.

Parents
  • 1700
    Verified Answer
    Offline posted

    Hello Lizzy,   

    The CellChnage event triggers when the cell exits edit mode and the new value could be obtained when the row that the cell belongs to is updated. If you would like to use the CellChange event and get the value of the cell on every key stroke, what I can suggest you is exiting edit mode on cell change, then updating the row and after that obtaining the new value of the cell and then entering edit mode again. In order to not get the cell texts selected, I recommend you obtaining the selection length from the EditorReselved and then setting the SelectionStart to this index. This would place the caret right at the end of the cell content and the user would be able to edit the cell without having to deselect and placing the caret at the end of the cell.

    For example if you would like to place the newly changed text from the UltraTextEditor inside of the UltraGrid in a TextBox using the CellChnaged event the code below could be used to achieve this:

     

     private void UltraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
            {
                if (e.Cell.Column.Key.Equals("Text"))
                {
                    this.ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
                    e.Cell.Row.Update();
                    textBox1.Text = e.Cell.Value.ToString();
                    this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);
                    // obetain the length of the selected text when entering edit mode and then place the carretIndex at the end of it
                    int carretIndex = e.Cell.EditorResolved.SelectionLength;
                    e.Cell.EditorResolved.SelectionStart = carretIndex;
    
                }            
            }

    I have also created a small sample application that demonstrates what I have explained above. 

    Please test the sample on your side and let me know if you have any questions. 

    Regards,
    Ivan Kitanov

    TextEditorInGridCaptureTextONntering.zip

Reply Children