Get ID of inserted record.

3 posts, 0 answers
  1. Jim
    Jim avatar
    19 posts
    Member since:
    Oct 2012

    Posted 07 Feb Link to this post

    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. Jim
    Jim avatar
    19 posts
    Member since:
    Oct 2012

    Posted 09 Feb Link to this post

    Anyone? Do I have to open a ticket?
  3. Eyup
    Admin
    Eyup avatar
    3125 posts

    Posted 14 Feb Link to this post

    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.
Back to Top