Hi,
I am new to UltraGrid control. I would like to populate th grid on runtime when user select an item from a combo box, data inserts into the grid .... and when user select another item from combo box, data should append to the grid.
i believe i can not use datasource in this scenario.
i have only one band in the grid. I get this error message: "Row insertion not supported by this data source". I tried to set AddNew property to true but it set itself to False.
This is the code i have written:
Me.cmboCatPart.Items.Clear()
For Each drPartsx As DataRow In MobService.ListSubItems(lngCatIdx, False).Rows
invRow.Cells(0).Value = drPartsx.Item(1).ToString
Next
lngCatIdx = Nothing
End Sub
Thanks for your help.
Kamal
You must assign a DataTable to the Grid's DataSource Property:
Dim dataTable1 As New DataTable("dataTable1")
Me.gridInvoice1.DataSource = dataTable1
Me
.gridInvoice1.DataSource = dataTable1
markachus said:You must assign a DataTable to the Grid's DataSource Property
This is not entirely accurate.
The grid must have a data source, it will not function without one. But it does not have to be a DataTable. The grid's DataSource can accept a wide range of objects such as a DataSet, DataTable, BindingSource, UltraDataSource, etc. It will bind to any object that implements either IList or IBindingList.
If you want to use the grid without any DataBase or back end, then I recommend using the UltraDataSource component as your grid's DataSource. Or perhaps a generic BindingList<T> object.
I am having a similar problem and I *do* have an UltraDataSource as the datasource for the grid. Basically, I just used the designer and let the designer create and bind the data source to the grid. I am now using UltraGrid.Rows.Band.AddNew() to add a new row (don't want to use the data source to do this, but I have verified that the row *does* get added if I add it via the data source). When I call AddNew, I get this exception. Help!
The only reason I can see why you would get this exception when using UltraDataSource is if you set AllowAddNew on the band (the UltraDataSource band, not the grid band) to false.
Hi all,
is there an event occuring before this message is shown?
Following scenario: Parent BindingSource with no rows, Child BindingSource, Grid bound to the Child BindingSource, Grid has AllowAddNew.TemplateOnBottom. User clicks in the TemplateRow. At this moment, I need to programatically add a row to the Parent DataSource, otherwise the above error message is displayed. I tried BeforeRowInsert and many others. All occur too late.
Thanks for any hint!
That's strange. Whenever I get this master-detail grids and the parent has no rows, the grid should not show the template row because the binding source tells it it can't add rows, so the user should add a new parent before. Maybe your binding is not correct?
Try set the child grid data source to the parent binding source and use the DataMember property like:
parentGrid.DataSource = ParentBindingSource;
childBindingSource.DataSource = ParentDataSource;
childBindingSource.DataMember = "Childs";
childGrid.DataSource = childBindingSource;
The parent class should have a property named "Childs"