Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ObjectDataSource UpdateMethod question

28 views
Skip to first unread message

Jeronimo Bertran

unread,
May 29, 2006, 4:06:57 PM5/29/06
to
I have a FormView that shows details of a specific record on a table. The
SelecMethod returns a DataSet that includes all the fields from my Event
table and other read-only fields from linked tables. My FormView has
controls that are bound to the fiuelds on the dataset table. I am now
changing the FormView's Default Mode to Edit but I am having problems with
the related fields.

My ObjectDataSource is defined as:

<asp:ObjectDataSource ID="ObjectDataSourceEventDetails"
runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="SelectEventDetails" TypeName="EventData"
DataObjectTypeName="System.Data.DataSet" UpdateMethod="UpdateEventDetails">
<SelectParameters>
<asp:ControlParameter ControlID="GridViewEvents"
Name="eventID" PropertyName="SelectedValue"
Type="Int64" />
</SelectParameters>
</asp:ObjectDataSource>


The EventData.SelecEventDetails performs a join with related tables and
returns a single table in a dataset with both the Event fields and the
related fields.

The EventData.UpdateEventDetails funcion takes as parameters the
original_EventID and only the editable fields that belong to the Event
table.

public void UpdateEventDetails(long original_EventID, byte SendState,
string EntryNotes)


I added a button to save changes and when the button is pressed I called:
FormView1.UpdateItem(true);


When UpdateItem is called I receive the following exception:

Could not find a property named 'ImageIndex' on the type specified by the
DataObjectTypeName property in ObjectDataSource
'ObjectDataSourceEventDetails'.

ImageIndex is a field found on a related table which is not updated by
UpdateEventDetails.

I am not sure if I should limit the SelectMethod to return the table and
do the databinding for the read only fields a different way.

Thanks

Jeronimo Bertran

Walter Wang [MSFT]

unread,
May 29, 2006, 10:56:09 PM5/29/06
to
Hi Jeronimo,

Thank you for your post!

ObjectDataSource.DataObjectTypeName is used to get or set the name of a
class that the ObjectDataSource control uses for a parameter in an update,
insert, or delete data operation, instead of passing individual values from
the data-bound control.

Since your UpdateMethod of ObjectDataSource is passing individual values,
you should remove 'DataObjectTypeName="System.Data.DataSet"' part from your
ObjectDataSource declaration.

For more information, see MSDN documentation on this property:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdat
asource.dataobjecttypename(d=ide).aspx

Hope this helps. If anything is unclear, please feel free to post here.


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jeronimo Bertran

unread,
May 30, 2006, 2:16:22 PM5/30/06
to
Thanks Walter

Walter Wang [MSFT]

unread,
May 30, 2006, 8:31:37 PM5/30/06
to
You are welcome.

Have a nice day!

0 new messages