Retrieve newly inserted object or ID using FormView with ObjectDatasource

I created a formview that uses an ObjectDataSource. After the insert is done I need to to retrieve the ID. I know how to do this using SQLDataSource but am not sure if it is possible using ObjectDataSource.
dmoss123Asked:
Who is Participating?
 
guru_samiConnect With a Mentor Commented:
Return the value from your method and then get it as e.ReturnValue

protected void ObjectDataSource1_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
    {
        e.ReturnValue // it's an object
    }

Open in new window

0
 
guru_samiCommented:
0
 
dmoss123Author Commented:
Using SQLDataSource, the output parameter (of the datasource) retrieves the ID using the return value of the stored procedure. I'm not sure how I would duplicate that with ObjectDataSource as the ObjectDataSource calls a method not a stored procedure.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.