Adding new rows to the grid can be done via the AllowAddNew property. It really doesn't make any difference if you are using RowEditTemplates or not.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridOverride ov = layout.Override; ov.AllowAddNew = AllowAddNew.TemplateOnBottom; }
The user can click on the TemplateAddRow and it will open a blank RowEditTemplate for the new row.
Hi,
I am using this form and I can add the row in the grid. But when I click on the new line to open the blank RowEditTemplate appearing on me the error:
Unable to add a new row. Underlying DataSource does not support adding new rows.
I'm only using the datasource .. I not have Dataset or Datatable.
Can help me please?
Thanks
That error message indicates that your grid's DataSource does not support adding new rows. What are you using as the grid's DataSource?
I'm loading a data list for ultragrid. A List (Of)
Okay, that's the problem then.
List(Of) it not really a good data source to use. It isn't really intended for data binding. Change your List to BindingList and it should work.
Hello Hélio,
I am just checking about the progress of this issue. Let me know if Mike's suggestion to change List collection with BindingList one as DataSource for your UltraGrid worked for you or if you need our further assistance.
Thank you for using Infragistics Components.
Hi Milko
I need more help. I already moved to BindingList list collection. But I have a problem. I listed the data from my database with ToList property and now have error. Should I change that?
Thank you for your feedback.
Can you please give me a little more information regarding your scenario:
1. What exception are you getting? Can you send me the exception message?
2. How are you getting you data ToList and then how you bind it to the UltraGrid?
It will help if you can send me a small isolated sample reproducing this behavior.
Please note if you have switched from List to BindingList and are trying to assign a collection with ToList method to BindingList variable this will throw an exception. Check your code for this.
Waiting for your feedback.
Please let me know if you need my further assistance on this matter.