0

Hi I have created a buttonfield in my Gridview with the CommandName sent to Delete. I have also Set the RowDeleting event on my GridView to a method. It doesnt run this method though. Giving me the error " Deleting is not supported by data source 'Cars' unless DeleteCommand is specified. "

My question is how do I get a button to launch an event similar to the GridView1_SelectedIndexChanged with the Select command. Thanks

user673906
  • 757
  • 6
  • 15
  • 30

2 Answers2

0

Have you declared your DataSource like this?

<asp:SqlDataSource ID="SqlDataSource1" runat="server" DeleteCommand="YourDeleteCommand"> <DeleteParameters /> </asp:SqlDataSource>

This will let the GridView know how to perform the delete operation...

Neil Hibbert
  • 852
  • 5
  • 10
0

The problem was I didn't create the row deleted event as well as the row delete event.

user673906
  • 757
  • 6
  • 15
  • 30