Hi Nick
Since posting the question Ive actually worked out what to do.
I can access the nested properties of the Customer object using nested templates that use the Eval operator to obtain the value (Bind doesnt seem to work) e.g.:
<asp:TemplateField HeaderText="Address 1">
<ItemTemplate>
<asp:Label ID="lblAddress1" runat="server" Text='<%# Eval("MailAddress.Address1
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtAddress1" runat="server" Text='<%# Eval("MailAddress.Address1
</EditItemTemplate>
</asp:TemplateField>
And then to actually update the Customer object i have to intercept the Updating event of the ObjectDataSource and manually update the object with the template field values:
Dim Customer As Person = e.InputParameters(0)
If CType(detailsviewCustomer.
Customer.MailAddress.Addre
End If
Main Topics
Browse All Topics





by: NickWaltPosted on 2008-04-16 at 01:48:19ID: 21365832
I think what you're trying to acheive here is similar to having 2 tables in a database and joing them and showing the results in a details view. I think the thing to think about is when you request this to be done using an SQL server you get the results as a table of data not nested data. So even though you would have attributes from 2 different source they are effectively merged into a single table of data.
I think you will need to provide the same thing when using the ObjectDataSource, you'll need to have attribute as a table of data rather than nested table which is what you have at the moment. I'll leave it up to you how to implement this, cos not sure why you've nested the tabled anyway so difficult to advise.
If it was me I would merge the tables in the design unless there was a really good reason not to. Or as you say expose the values through extra properties, which is probably what you're asking.