I have multiple SqlDataSources and GridViews, which are doing the select/update/delete methods. I manually did the Insert method for each Gridview and I am able perform error handling on it.
Expand|Select|Wrap|Line Numbers
- Textboxes for data to add
- <asp:Button ID="btnInsertNewService runat="server" Text="Submit" OnClick="btnInsertNewService_Click" />
- protected void btnInsertNewService_Click(object sender, EventArgs e)
- {
- try
- {
- sdsServices.Insert();
- }
- catch...Error Handling here...
So what I tried was just like the Insert. I set the OnClick property of the Delete button in the GridView to a new method that calls sdsServices.Del ete(). I get this error though:
"You have specified that your delete command compares all values on SqlDataSource 'sdsServices', but the dictionary passed in for values is empty. Pass in a valid dictionary for delete or change your mode to OverwriteChange s. "
Anything I try to delete on the GridView gets the error. After trying a few different things with that, I looked around found some info that said to use the OnDeleted or OnDeleting for the Gridview and use SqlDataSourceEv entArgs for either of those, which allows for error handling.
When I tried it with OnDeleting I would just get an error saying there was no overload for those EventArgs. When I tried it with OnDeleted I would get no errors, but nothing would delete from the GridView.
I hope I have explained this clearly enough. Can anyone point me in the right direction?