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

Get ID of inserted record.

2 Answers 275 Views
Grid
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 07 Feb 2017, 02:48 PM

I've searched the forums with no luck. 

What I need to do is send an email with the ID of the newly inserted items ID that is generated from SQL(isIdentity)

I was assuming that I could get this info from RadGrid1_ItemInserted but no luck.

Dim editformItem As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem)
Dim test As String = editformItem.Item("Task_Id").Text

-DataKeyNames="Task_Id"

I need the id of the inserted item.

Can someone please help.

Thank you


 

2 Answers, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 10 Feb 2017, 12:19 AM
Anyone? Do I have to open a ticket?
0
Eyup
Telerik team
answered on 14 Feb 2017, 06:23 AM
Hi Jim,

When updating the item, the you can access the ID of the modified item since there is an actual grid item:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values

When inserting, however, since there is no grid item generated at that time, the grid has no info about that record. Therefore, you should get this info from your database, for instance - using some event or query of the SQL data source.

You can also check the provided explanation and web site sample here:
http://www.telerik.com/forums/select-inserted-updated-row-after-performing-command#UqPp6075pUO9rOJsy-RmIw

I hope the clarification was helpful.

Regards,
Eyup
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or