Answered by:
Can't Delete Categories or Projects

Question
-
User-954169400 posted
I get this message when i try to delete a category
Server Error in '/TimeTracker' Application.
ObjectDataSource 'CategoryData' could not find a non-generic method 'DeleteCategory' that has parameters: Id.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: ObjectDataSource 'CategoryData' could not find a non-generic method 'DeleteCategory' that has parameters: Id.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: ObjectDataSource 'CategoryData' could not find a non-generic method 'DeleteCategory' that has parameters: Id.] System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters, DataSourceOperation operation) +1330006 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +1067 System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +75 System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +927 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1134 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +199 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
And I get this message when i try to Delete a Project
Server Error in '/TimeTracker' Application.
Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'
Source Error:
Line 40: protected void ListAllProjects_RowDeleting(object sender, GridViewDeleteEventArgs e) { Line 41: Line 42: e.Keys.Add("Id", ListAllProjects.Rows[e.RowIndex].Cells[0].Text); Line 43: } Line 44: }
Source File: c:\WebSites\TimeTracker\TimeTracker\Project_List.aspx.cs Line: 42
Stack Trace:
[ArgumentException: Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'] System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) +2904181 System.Collections.Hashtable.Add(Object key, Object value) +11 System.Collections.Specialized.OrderedDictionary.Add(Object key, Object value) +49 Project_List_aspx.ListAllProjects_RowDeleting(Object sender, GridViewDeleteEventArgs e) in c:\WebSites\TimeTracker\TimeTracker\Project_List.aspx.cs:42 System.Web.UI.WebControls.GridView.OnRowDeleting(GridViewDeleteEventArgs e) +133 System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32 rowIndex) +604 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1134 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +199 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Does anyone know how to fix this?
Thanks
Wednesday, September 15, 2010 4:08 PM
Answers
-
User-954169400 posted
I figured out the problem with the Category Delete.....it wasn't wired up in the object datasource. I just had to go in and select the delete method.
I found a work around for the Delte Project button. It didn't work on the project list page grid but it did work on the edit page so I just removed the delete button from the grid. Then i just deleted using the delete button at the bottom of the edit page
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, September 15, 2010 11:32 PM