Okay, I have searched the internet a lot to no avail. I have a class that accepts a custom class that encapsulates my data. I use this to pass between my different gridviews and detailsviews controls through an object data source.
Update works fine without even having an update parameters collection of tags on the aspx page. It passes through with no problem. But when I try to add in a session parameter which grabs the current userID (so I can keep track of who makes the changes) it outputs the following. I have verified that all the names are correct, but the problem still exists anytime the function definition has anything but the TaskDetails datatype.
If anyone could help me figure out how to pass this object and the session parameter through, it would greatly reduce the stress I am feeling over this!
Thanks
Below is the code on the page, TaskDetails is just a class with properties and underlying varaibles. The OldValuesParameterFormatString makes no difference either way.
1 <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DataObjectTypeName="TaskDetails"
2 SelectMethod="GetTaskByTaskID" TypeName="TaskManagement" UpdateMethod="UpdateTask" OldValuesParameterFormatString="{0}">
3 <SelectParameters>
4 <asp:ControlParameter ControlID="GridView1" Name="taskID" PropertyName="SelectedValue"
5 Type="Int32" />
6 </SelectParameters>
7 <UpdateParameters>
8 <asp:Parameter Name="newTask" Type="Object" />
9 <asp:SessionParameter Name="id" SessionField="userID" Type="String" />
10 </UpdateParameters>
11 </asp:ObjectDataSource>Below is the fuction definition:
1 public bool UpdateTask(TaskDetails newTask, string id)
I passed as a string and then parse the int, but it breaks the same way if I use an Int32.
Error is below: ObjectDataSource 'ObjectDataSource2' could not find a
non-generic method 'UpdateTask' that takes parameters of type
'TaskDetails'
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 'ObjectDataSource2' could not find a non-generic
method 'UpdateTask' that takes parameters of type 'TaskDetails'.
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 'ObjectDataSource2' could not find a non-generic method 'UpdateTask' that takes parameters of type 'TaskDetails'.] System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, Type dataObjectType, Object oldDataObject, Object newDataObject, DataSourceOperation operation) +663 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +1572 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +179 System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +1197 System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +545 System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +162 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56 System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +117 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +107 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +179 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838 |