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.
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
Hello Ivan,
thanks for the details.
I modified the sample, the way m using it. I followed infragistics legacy code for this.
please get the sample from the following link
https://drive.google.com/file/d/1b_Bon36eGnse7jMmrugmzV4-6daXX2ZO/view?usp=sharing
here, UltraGrid1_CellChange is not triggering , please check.