Grid View Delete Command.
-
I want to delete an item from my GridView (and my database) when a user clicks on my Delete CommandField. I've been told I need to set the DeleteCommand property, but this is just a string. How do you add parameters to this delete command and assign those parameters (namely the ID of the record the user wants to delete)?
-
I want to delete an item from my GridView (and my database) when a user clicks on my Delete CommandField. I've been told I need to set the DeleteCommand property, but this is just a string. How do you add parameters to this delete command and assign those parameters (namely the ID of the record the user wants to delete)?
I'm going to answer my own question. You have to set up the data source to automatically generate the delete statements using the "Advanced" settings in the wizard. I'd still like to know how to do this programatically specifying my own sqlcommands and parameters and linking it up to the built in DeleteCommand button.