ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.FirstCellInGrid).
ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.entereditmode).
When are you doing this? In what event?
in the Constructor method of the class. basically, i am starting out with an empty grid and want the user to populate it using the 'AddRowOnTop'. i want focus to be in the first field so they can just start typing without having to mouse click. i have been trying to figure out how to programmatically set ActiveRow = the AddRow with no luck. thanks for getting back to me on this.
markaston said:in the Constructor
That's probably the problem. You cannot set focus to a control on a form before, or even during, the Form_Load event. This is not limited to the grid, it's tue of any control.
You might try using the Form_Shown event. I think this might be one of the reasons this event was added by Microsoft.
If that doesn't work, then I would try using the form's Paint event and just use a flag to make sure you on;y call your code the first time the event fires.
Another option would be to use Form_Load or Form_Shown and use a BeginInvoke to call a method that sets focus and puts the grid into edit mode, rather than calling the code from directly inside the event.
Hi all, I have a similar problem, I have this code
ultraGrid1.DisplayLayout.Bands[0].AddNew();ultraGrid1.DisplayLayout.Bands[0].Columns["CODE"].Header.Caption = "Cod";ultraGrid1.DisplayLayout.Bands[0].Columns["DESCRIPTION"].Width = 250;ultraGrid1.ActiveCell = ultraGrid1.Rows[0].Cells[0];
I am traying to put the focus on the firts cell (CODE) but the cell don't enter in edit mode.
Hi Mike ,
There is an issue , when I am tabbing it is giving me a "Object reference not set to an instance of an object exception" ..
below is the exception details , when I debugged I got to know that "obj.FocusControl " is null ,pls guide me in this on setting the Focus Control property with some thing from the code.
Exception Message:
Object reference not set to an instance of an object.
---------------------------------------------------------------------------------------------------
Stack Trace:
at views..SearchGrid_KeyDown(Object sender, KeyEventArgs e)
at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
at Infragistics.Win.UltraControlBase.OnKeyDown(KeyEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridBase.EditorContainerControlOnKeyDown(KeyEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridBase.OnKeyDownForwarded(KeyEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.OnEditorKeyDown(Object sender, KeyEventArgs e)
at Infragistics.Win.EmbeddableEditorBase.RaiseKeyDownEvent(KeyEventArgs e)
at Infragistics.Win.EmbeddableTextBox.OnKeyDown(KeyEventArgs e)
at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.ProcessKeyMessage(Message& msg)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.WndProcInternal(Message& m)
at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
For staying the new row of the UltraWinGrid 2010, these lines work for me in the BeforeRowUpdate event:
e.Cancel = True grdTranslationFields.RowUpdateCancelAction = RowUpdateCancelAction.RetainDataAndActivation e.Row.Cells(5).Activate()
Hope that help.
I am not able to put focus in newly added row. I am doing through javascript : My code is
var grid = igtbl_getGridById('<%=uwgSiteAlias.ClientID%>'); var rows = grid.Rows;
var nRow = rows.addNew();var LastRow = rows.getRow(rows.length-1);
var cmd = "<a href='BLOCKED SCRIPTremoveRow()'>remove</a>";
LastRow.getCell(4).setValue(cmd); LastRow.getCell(4).getElement().innerHTML = cmd LastRow.activate(true);
Regards,
Pawan Shah
Hi Seema,
I'm having trouble understanding what you mean, but it sounds like maybe you are trying to perform an operation on the selected text inside a cell without losing focus. If you use a button control, then the button will take focus away from the grid and you will lose the selection - so that won't work. Typically, formatting buttons like are would be toolbar buttons which do not take focus. It's the same with Cut, Copy, and Paste - you have to use a control that doesn't take the focus away. Otherwise you lose the context of what you are cutting, copying, or pasting.
hi,
I am also facing the same issue, where i am selecting few characters from the activecell text and then want to color only those characters.
but the grid looses its editmode property and if i explicitely add it by using
PerformAction(UltraGridAction.EnterEditMode);
it looses the selection event thought the cell regains its editmode property.
Can i get the selection of characters after using
PerformAction(UltraGridAction.EnterEditMode); funtion.
Please let me know, or can you provide some alternative for the same.
Thanks & Regards,
Seema Sharma