Nested Properties in a GridView ASP.Net 2.0

E

Eyal

Hi.

I am using a GridView to display records from an ObjectDataSource. My
middle-tier layer have nested properties, meaning that I have things like
Employee.Name.FullName, where Employee is what I am binding the grid to
while FullName is what I want displayed.

For some reason the GridView does not allow me to do something like
DataField="Name.FullName". This fine in a Windows Form DataGridView, but not
in ASP.Net GridView!

Is this a known issue? Are there any workarounds for it? Thanks in advance,
Eyal.
 
M

Mikeon

I am using a GridView to display records from an ObjectDataSource. My
middle-tier layer have nested properties, meaning that I have things like
Employee.Name.FullName, where Employee is what I am binding the grid to
while FullName is what I want displayed.

For some reason the GridView does not allow me to do something like
DataField="Name.FullName". This fine in a Windows Form DataGridView, but not
in ASP.Net GridView!

Is this a known issue? Are there any workarounds for it? Thanks in advance,

Check out my blog at:
http://vaultofthoughts.net/UsingBindWithNestedProperties.aspx

Where I describe how to deal with similar issues.

Also check out my articles on problems with ObjectDataSource:
http://vaultofthoughts.net/ProblemsWithObjectDataSource.aspx

and a working alternative
http://vaultofthoughts.net/ObjectDataSourceAWorkingAlternative.aspx
or better yet with all other controls:
http://vaultofthoughts.net/ASPNETControlsPack.aspx

Of course, all feedback is always welcome.
 
E

Eyal

Thank you Michal for the response. This is actually very similar to what we
have came up with. However, I do consider this solution a work around the
problem (please take no offense as we have come up with the same idea). Do
you (or anyone else) know if there are any plans for adding this
functionality in a future version of the grid or perhaps in an "Atlas" CTP.
Thank you again. Eyal.
 
M

Mikeon

Thank you Michal for the response. This is actually very similar to what we
have came up with. However, I do consider this solution a work around the
problem (please take no offense as we have come up with the same idea). Do
you (or anyone else) know if there are any plans for adding this
functionality in a future version of the grid or perhaps in an "Atlas" CTP.

I do not think they will do it soon. This is not a problem with a grid.
It is a problem with how Bind works.
When Bind retrievs data from a data-bound field it takes the string
representation and transforms it to your destination type. With nested
object it would be very difficult to do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top