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
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.
Have a nice day!