ObjectDataSource: UpdateParameters ignored when specifying DataObjectTypeName?

P

Phillip Ian

I've got the following:

<asp:ObjectDataSource ID="lu" runat="server" TypeName="cFactory"
SelectMethod="GetLookup" UpdateMethod="UpdateLookup"
DataObjectTypeName="cLookupItem">
<SelectParameters>
<asp:QueryStringParameter Name="which" QueryStringField="lookup"
/>
</SelectParameters>
<UpdateParameters>
<asp:QueryStringParameter Name="which" QueryStringField="lookup"
/>
</UpdateParameters>
</asp:ObjectDataSource>

<asp:GridView ID="GridView1" runat="server" DataSourceID="lu"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Name" />
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>

Rather simple little one-column editable gridview.

My problem is with the update parameters. If I specify
DataObjectTypeName, the UpdateParameters section of the
ObjectDataSource seems to be ignored: "ObjectDataSource 'lu' could not
find a non-generic method 'UpdateLookup' that takes parameters of type
'cLookupItem'."

Is that normal? I'd like to pass my object plus selected other
parameters to the update method. If I omit the DataObjectTypeName, I
correctly get "ObjectDataSource 'lu' could not find a non-generic
method 'UpdateLookup' that has parameters: which, Name."

Obviously, I could write the update method to take which and Name as
parameters, but there are other cases which use other properties of the
cLookupItem object. I'd hate to have to make different update methods
for each.
From what I can tell, it is EITHER DataObjectTypeName OR
<updateparameters> but NOT both. Can someone verify that? Seems a bit
limiting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top