Displaying a property of an entity in a databound control datafield

75 views Asked by At

I have a linq to sql query From tbl in tableentity select tbl which gives me the table. The table has relations so some properties points to other tables. Heres the problem: I want to display a property from a table that is pointed by a property in tbl via the datafield property of a databound control. Say the property that points to the related table is named reltbl: BoundField bf = new BoundField(); ... bf.DataField = "reltbl.Name"; It says a property was not found in the selected datasource.

Sorry about the mess, it's written from my phone

1

There are 1 answers

0
Sharon Dorot On

Apparently you cant use nested properties in datafield, so I used the solution in www.stackoverflow.com/questions/1130351/gridview-bound-with-with-properties-of-nested-class