Hi, When having no data in my own IBind collection on form load, I bind the collection using the function wingrid.SetDataBinding(collection, null, true); via the run-time. However, the collection then comes back with having an object in it ( therefore the count = 1) and therefore a blank row is created. is there a way for the grid from preventing this behaviour when the collection is 0 before the bind?Note: When there is data before the bind. i.e. data from the back-end..the grid works perfectly by only creating 1 row per object inside the collection, but if there is no data from the backend, the above happens.ThanksChris
Hi Chris,
The grid doesn't create any new rows. What's probably happening here is that the grid is asking the DotNet BindingManager for the structure of the data so that the grid can build the bands and columns. If there are no rows in the data source and the data source doesn't expose the structure, the BindingManager will create a new row, get the structure from that row, and then cancel it. Of course, if your data source doesn't support cancelling new rows, that row will stay around.
I recommend using a BindingList<T> or some derived types as your data source. That will save you a lot of headaches. But if you are writing your own data source from scratch and implementing IBindingList or IList, then you will probably need to implement some other interfaces to make things work properly, like ITypedList and/or IEditableObject and/or ICancelAddNew.
Hi Mike,Thanks for the reply.Basically are we are using .NET 1.1 so we have Infragistics2(v7.1) libraries so that is why we've created our own datasouce. However, as it is .Net 1.1 this means that we do not have the interface ICancelAddNew. If we created our own. Will there any problems on the infragistics reflection engine? (it may not even matter..) And we do implement IBindingList and IList if that's any use.ThanksChris