Pregunta

I am trying to bind a BoundField of a DetailsView control to a child object of the datasource, I can't seem to find the right syntax.

Here's some sample code;

<asp:BoundField DataField="Address.Postcode" HeaderText="PostCode" />

This code doesn't work but you get the idea.

Using this code I get the exception; A field or property with the name 'Address.Postcode' was not found on the selected data source.

Thanks.

¿Fue útil?

Solución

you can use item template .... take a look at this link

<asp:TemplateField HeaderText=”First Name” SortExpression=”Person.FirstName”>
<ItemTemplate>
    <asp:Label ID=”FirstNameLabel” runat=”server” Text=’<%# Eval(“Person.FirstName”) %>’></asp:Label>
</ItemTemplate>

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top