Insert/Update from GridView
Posted on 2006-06-19
So I'm trying to break down and learn how to work with the SqlDataSource controls, and insert/update from a Gridview. Here's what I have
I have a Gridview bound from a SqlDataSource control. The SelectCommand I'm using is a fancy join, so it doesn't follow the standard examples. I basically need to do the following when I issue an update command.
- Delete all rows for a particular table that have a certain value in a column (I can easily plug this value from a control parameter)
- For each record I've checked (through a GridView/TemplateField/Checkbox), Insert a new row into a table with values, based on other textbox fields in the current row of the GridView.
Can someone give me ideas about how I can best accomplish this? Being that the process requires multiple SQL statements, I want to wrap the entire deal in a Sql Transaction. Is that even possible?