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

Save a New Row as Soon as User has Added It

1 Answer 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 12 Apr 2016, 06:31 AM
When a user clicks the "Click Here to Add a New Row" bar, I need to fill some default values and immediately save the row to the database, before the user has done anything else. I'm using the DefaultValuesNeeded event to fill the default values but if I call Update on my dataAdapter from this event, nothing happens, since the new row hasn't really been added to the collection of rows yet. Is there any way I can save the new row to the database at this point?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Apr 2016, 12:34 PM
Hello Simon,

Thank you for writing.

In some cases, you may need RadGridView to create a record in the underlying data source after the end-user commits the new row. In other cases, you may want to have a new record created immediately after the end-user starts editing the new row. RadGridView supports both modes. The behavior of RadGridView in this situation is determined by the AddNewBoundRowBeforeEdit property. The following help article is quite useful on this topic: http://docs.telerik.com/devtools/winforms/gridview/rows/new-row

As to the updating the database you can have a look at link and use this event which suits your requirement best: http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net

I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Simon
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or