Mix bound and unbound Hierarchical Grid

1 Answer 15 Views
GridView
Leenah
Top achievements
Rank 1
Iron
Leenah asked on 28 Mar 2022, 01:39 PM

Hello,

I am developing a hierarchical radgridview using winform. I am able to retrieve data from the database (bound data). I would like to enable users to add multiple rows in the same radgridview and then save everything to the database. I have developed another radgridview that allows users to enter data. but I want to perform these functionalities into one radgridview.

When I am trying to do that, the system says: " Rows cannot be programmatically added to the datagridview's row collection when the control is data-bound".

Can you help me with this please?

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Mar 2022, 12:29 PM
Hello, Lina,

Indeed, when RadGridView is used in bound mode, it is not allowed to manage programmatically the grid's Rows collection. That is why you are observing the mentioned message. However, it is allowed to edit the existing data or add new rows via the UI. If you want to add new records or manage the existing ones programmatically, the appropriate way to do it is through the assigned DataSource collection, not via the Rows collection.

Since I am not aware of the exact setup that you have in the RadGridView control, I would recommend you to have a look at the following help articles demonstrating how to handle the changes in RadGridView and store them back to the database:
Updating the Database with ADO.Net
RadGridView CRUD in Object Relational Hierarchy Mode

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Leenah
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or