Hi
I am setting a UltraNumericEditor to a column in grid as fallows
UltraNumericEditor editorForDecimalColumns = new UltraNumericEditor();
editorForDecimalColumns.NumericType = Infragistics.Win.UltraWinEditors.NumericType.Double;
editorForDecimalColumns.MaskInput = "nnnnnnnnn.nnnnnnnn";
ultraGridRow.Cells["MyColumn"].EditorControl = editorForDecimalColumns;
and added the events as fallows
editorForDecimalColumns.AfterEnterEditMode += new EventHandler(editorForDecimalColumns_AfterEnterEditMode);
editorForDecimalColumns.Click += new EventHandler(editorForDecimalColumns_Click);
ultraGridRow.Cells["MyColumn"].EditorControl.MouseClick += new MouseEventHandler(EditorControl_MouseClick);
but the problem is none of the events are getting fired when we click or enter the cell in MyColumn in grid.
I want to select the text in the cell of MyColumn if we click it for first time.
Can someone help me to select the entire text in the ultraNumericEditor or can why the events are not firing.
Thanks in advance
Navi
Hi Navi,
This has been discussed on the forums quite a number of times. Search for some of my posts involving the EditorControl property.
Basically, the grid doesn't use the actual control. The editor control just provides a copy of it's editor to the grid. So almost no events on the control will fire in response to anything you do in the grid. The grid has it's own events and you should use those.
In this case, you probably need to use the AfterEnterEditMode event on the grid.
HI Mike
First thing I did is to using AfterEnterEditMode event for selecting the whole text on click of the cell. But the problem is I am getting an exception saying that "Operation can not be performed when not in edit mode". Since the ultraNumericEditor is set to the column I tried the custom events.
Can you tell me how to select all the text in the cell when clicked.
This should work okay in AfterEnterEditMode, but you need to make sure you are selecting the text in the Cell. Once again, the grid does use the NumericEditor control, so if you are trying to select the text in the UltraNumericEditor, that's why it's not working.
To select all of the text in a cell you have to use properties on the cell, like SelectionStart and SelectionLength, or maybe the SelectAll method, if there is one on the cell.
Hi Mike
Thanks for the reply.
I am adding a picture which shows my problem.
As you suggested I have done that, but I am getting an error which is shown in the picture.
Even though it is in afterEnterEditMode event it is showing that it is not in edit mode.
For the cell which does not have an editorcontrol attached to it is working fine, but the cell with editorControl is throwing this error. Is this a bug in ultragrid? if not then how should I go about to solve the above problem
I tried this out using an UltraNumericEditor control in a decimal column and I used the following code:
private void ultraGrid1_AfterEnterEditMode(object sender, EventArgs e) { UltraGrid grid = (UltraGrid)sender; grid.ActiveCell.SelectAll(); }
This works fine for me with no error. I even tried clicking on the cell and tabbing into it, just in case it made a different which way the cell was activated.
So it seems like either you are using an old version of the controls and that this has already been fixed, or else there is some other factor at work in your application that is not happening in my sample.
So my first recommendation is that you get the latest service release and see if that helps:
How to get the latest service release - Infragistics Community
If that does not help, then we will need to see a small sample project demonstrating the error so we can check it out.