raphael232
Programmer
This is an update on my original post, after a little research i have descovered that pass a variable number of parameters into a method/function you use ParamArray, ie:
In my web form page i have:
and when i run the application my title appears, along with any additional attributes which are sent in the getDocumentByID method but when i edit the record i recieve the following error:
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateDocument' that has parameters: title, documentID, Attribute 1, Attributes 2.
I'm sure it's something trivial i'm missing. Appreciate your help. Thanks
Code:
Public Function UpdateDocument(ByVal title As String, ByVal documentID As Integer, ByVal ParamArray list As Object()) As Boolean
DocumentsAdapter.Update(title, documentID)
' handle additional parameters
Return True
End Function
In my web form page i have:
Code:
<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="ObjectDataSource1"
Height="50px" Width="125px">
<Fields>
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteDocument"
InsertMethod="InsertDocument" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDocumentByID"
TypeName="DocumentManager" UpdateMethod="UpdateDocument">
<DeleteParameters>
<asp:Parameter Name="documentID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="documentID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Name="documentID" QueryStringField="ID"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="title" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
and when i run the application my title appears, along with any additional attributes which are sent in the getDocumentByID method but when i edit the record i recieve the following error:
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'UpdateDocument' that has parameters: title, documentID, Attribute 1, Attributes 2.
I'm sure it's something trivial i'm missing. Appreciate your help. Thanks