Hi,
Can the ultragrid mimic the default behave of the windows DataGridView where a new row is automatically added when you start entering data on the first/previous row? or after you press tab on the last column of the row?
I found the property "AllowAddNew.TabRepeat" that according to the description was the thing I was looking for, but it's not happening...
e.Layout.Override.AllowAddNew = AllowAddNew.TabRepeat;
I added this line of code in the InitializeLayout of my ultragrid but it's not adding the new row when I Tab, Tab, Tab until the last column...
Did I miss anything?
My data source is a simple dataTable and my version of infragistics 2009
Thanks!
Hi Monica,
I'm not sure I understand what the problem is.
TabRepeat only adds a new row when the user is editing the AddNewRow and tabs out of the last cell. It will not work on an existing row if that's what you want.
You could probably implement that yourself using the BeforePerformAction event. But it's not entirely clear to me what behavior you want, exactly, so it's hard for me to be more specific.
I click on the Add button and it adds the first row to the grid, I fill out the information, press tab until the last column and keep pressing tab, but it doesn't automatically add a new row...
here is my code.
private void toolStripButtonAdd_Click(object sender, EventArgs e)
{ try { ultraGridColumns.DisplayLayout.Bands[0].AddNew(); } catch (Exception ex) { UtilMsgBox.LogAndShowErrorMsg(ex); } }
private void ultraGridColumns_InitializeLayout(object sender, InitializeLayoutEventArgs e) { try { e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; e.Layout.Override.CellClickAction = CellClickAction.EditAndSelectText; e.Layout.Override.AllowAddNew = AllowAddNew.TabRepeat; e.Layout.Override.SupportDataErrorInfo = SupportDataErrorInfo.CellsOnly; } catch (Exception ex) { UtilMsgBox.LogAndShowErrorMsg(ex); } }
I tried this and it always works fine for me, so I attached my sample to this post for you. Please review it and feel free to let me know if I misunderstood you or if you have any other questions.
Thank you Boris. Exactly the answer I was looking for at least. It's years later but your suggestion still works. Thanks!
Based on this last post, I believe that you are looking for the template add new row functionality, please try the following setting:
e.Layout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom;
Does the above suit your needs?
Hi Boris,
Sorry for the delay in getting back to you on this issue. I was moved to another project for a while. but I'm back. So
I tried you sample. It sort of does what I want, but not exactly. in order to make the tab create a new row when it's pressed in the last column/row you first need to add a new row clicking in the ultrabutton1.
if you just run your sample and press tab among the cells (editing them or not) it wont add a new row once in the last column/row.
The ultimate behaviour I want is to always have an empty line in the bottom. if data is entered in the last row a want to automatically enter a new row...
Any ideas?
Monica,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
Tried this scenario as well and it works the way it should be. Please let me know if you manage to reproduce this in a sample, I will be glad to assist you further on that matter.