I have a gridview with existing records displaying fine. I'd like to have a control field that would allow me to "clone" this record only with a new record ID number chosen of course by my SQL Server's table's identity key field. Is this possible?
Get the id of the record you want to copy from the grid, make a call to the db, create a new record, copy the fields and insert the new record in the db with a new id of course.
Eugene1968
Member
90 Points
360 Posts
Copying a record programmatically
Jan 17, 2013 03:17 PM|LINK
I have a gridview with existing records displaying fine. I'd like to have a control field that would allow me to "clone" this record only with a new record ID number chosen of course by my SQL Server's table's identity key field. Is this possible?
alex_brambil...
Participant
771 Points
278 Posts
Re: Copying a record programmatically
Jan 18, 2013 11:13 PM|LINK
Get the id of the record you want to copy from the grid, make a call to the db, create a new record, copy the fields and insert the new record in the db with a new id of course.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Copying a record programmatically
Jan 19, 2013 02:19 AM|LINK
If you do manually data-binding. Just handle the event of GridView's SelectIndexChanged,and then do this:
DataTable.Rows[index][index]——Copy the value one column by one column, to where you think suitable.