This is a migrated thread and some comments may be shown as answers.

[Solved] Insert in MultiRowEdit and InPlace

1 Answer 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher Borys
Top achievements
Rank 1
Christopher Borys asked on 24 Sep 2009, 12:18 AM
I have a problem handling the inserts to a grid using "InPlace" edit and "MultiROwEdit".
The Grid is bound to a DataSet (SQL) table.  I want to be able to keep inserting multiple rows (items) into the grid and edit them.
The "AllowAutomaticInserts" is set to false.  I am catching the insert events in "OnItemDataBound" handler.

In there, I am creating a new 'empty' data row and adding it to the table.  Then, I bind the row to inserted item, make it aditable, and finally I change "IsItemInserted" to false to allow for more inserts.

DataTable.AddRow(row);  // add row to table

insert_Item.DataItem = row;

insert_Item.Edit =

true;

 

rdgrd.MasterTableView.IsItemInserted =

false;

This turns the last item in the grid into regular, non-editable item unless Refresh is pressed.
I was wondering wether there is a cleaner way of doing multiple inserts to a grid where all rows are turned into editable items.  I could not find any single example exploring this scenario.

Thank you,
Chris

 

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 29 Sep 2009, 06:40 AM
Hello Christopher,

Unfortunately, RadGrid does not support multiple insert forms visible simultaneously. The rationale is that a user would usually insert items one by one and would not need multiple empty insert forms. The approach you have taken may potentially cause problems later when updating items, as empty data rows do not have any kind of a unique key matching them to RadGrid data items. Even when you set:

insert_item.DataItem = row;

when updating, RadGrid will rebind and will not find the empty data row attached to the updated item.

Finally, our suggestion would be to use an external insert form if you want multiple insert items, where you would handle the inserts yourself.

Greetings,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Christopher Borys
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or