Hi VJ,
I don't actually think both methods (aspx code and c#) will work for
boundfield (i tested it). However, it will work for templatefield and
Eval("Name.FirstName"). BTW, have you worked for Image Int?
--
Milosz
"VJ" wrote:
> Hi,
>
> I'm certain I'm not the first person to run into this, but here's the
> scenario:
>
> I have a collection of objects say of class 'User' which I want to put
> as the datasource of a GridView. I can bind to properties of User
> fine. But suppose I want to bind to a property one level down. (Say
> User has a property of class Name which has 2 properties 'FirstName'
> and 'LastName', both strings. So I'd like to be able to put:
>
> <... DataField="Name.FirstName"..> (in xml)
> DataField="Name.FirstName'; (in C#)
>
> As far as I know the first is possible (it's smart enough to traverse
> down and find FirstName) while the second is not.
>
> My question is why exactly is this and what's a simple or elegant
> workaround (using just code behind). I don't want to create a new
> class just so that it's more convinient to bind to the grid view, nor
> do I want to copy things manually into a datatable, or anything like
> that.
> Any input appriciated,
> VJ
>
>
|