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

radgrid add and collect multiple new empty records

1 Answer 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 30 Sep 2011, 03:51 PM
in the example below I would like to have an ability to add a new  empty row every time
"add new record" is clicked and then roll through somekind of  "new items" collection to grab
all info entered and save to db  in one bulk transaction. Is this possible ?

 in the example It only allows to add one empty record and nothing happens when
"add new record" is clicked again. I also can not figure out how to get  that new record (before it is saved in db)
from outside of the grid, like from some button click. The Grid.Items collection does not reflect that new empty
record and EditItems is also empty.

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/templateformupdate/defaultcs.aspx



1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 05 Oct 2011, 08:28 AM
Hello Tim,

The RadGrid does not support the desired functionality when it is bound to a datasource control. In this case the new records (empty or not) will be shown into the RadGrid after rebind. When the rebind is performed the data for the RadGrid is got from the DataBase and all rows are recreated. So to get the new added empty row from the RadGrid.MasterTable.Items collection you need to add it first into the database and then rebind the RadGrid.
If you want to have an empty rows into the RadGrid without adding them into the Database you could try using advanced data-binding and bind the RadGrid to an in memory DataTable. This approach is used into the following code library:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/excel-like-radgrid.aspx

I hope this helps.

Kind regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
General Discussions
Asked by
Tim
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or