I have the following situation:
My business class:
public class Foo
{
public String A {get;set;}
public DateTime B {get;set;}
// .. and other properties like
public String Intern {get;set;}
}
I'm binding that Item to a DetailsView in Editmode. (I bind a List containing a single object of Foo, becuase I do recall that I can only bind IEnumerable<> classes to the DetailView) The binding is done via a ObjectDataSource
<asp:ObjectDataSource ID="odsEditfoo" runat="server"
SelectMethod="GetFooAsList"
TypeName="mynamespace.FooMethods"
DataObjectTypeName="mynamespace.Foo"
oninserting="odsEditfoo_Inserting" onupdating="odsEditfoo_Updating"
UpdateMethod="UpdateFoo">
<SelectParameters>
<asp:Parameter Name="A" Type="Int32" DefaultValue="-1" />
<asp:Parameter DefaultValue="-1" Name="type" Type="Object" />
</SelectParameters>
</asp:ObjectDataSource>
The updatemethod looks like
public void UpdateFoo(Foo item)
{
// save changes ...
}
The changes that are done in the DetailsView are present in the item instance. Unfortunetly I can't display every property such as the property Intern. As the item is bound to the DetailView I have all the necessary information. All none displayed properties are lost in the item the moment the postback occurs.
I'm looking for a way I'm used to have from the LinqDataSource, where I have an Updating-Event that allows me access to the bound object, in this case an instance of foo, to alter properties. I can't seem to figure out how to this in the Updating-Event of the ObjectDataSource. What must I do to fix this?