ASP.NET 2.0 - How to databind to nested (hierarchical) business objects?

Discussion in 'ASP .Net Web Controls' started by style, Sep 8, 2006.

  1. style

    style Guest

    Hi everybody

    Is it somehow possible to databind a control to a nested business object in
    ASP.NET 2.0?

    Let's say I have a business object "User" with the properties "Name"
    (string), "Age" (int) and "Place" whereas Place is a reference to another
    business object of the type Location. The class Location has the properties
    "ZipCode" (int) and "City" (string).

    Now I can bind my control to Name and Age because these properties are
    primitive data types. But I don't know how to bind it to the the City
    property of the nested object Place.

    Any ideas? Maybe .NET 2.0 has some other happy surprises I didn't know of
    yet, f.e. something like Bind("Location.City")... : )

    Kind regards
    Thomas
    style, Sep 8, 2006
    #1
    1. Advertising

  2. style

    Amar Guest

    Re: ASP.NET 2.0 - How to databind to nested (hierarchi...

    Any luck on this?

    Trying to do the same thing
    Amar, Sep 15, 2006
    #2
    1. Advertising

  3. style

    style Guest

    Re: ASP.NET 2.0 - How to databind to nested (hierarchi ...

    No, I haven't found an answer yet. Anybody any ideas?

    As a workaround I did the following... I am exposing the City (=property of
    the nested Location class) in the User class as a property:

    public string City
    {
    get
    {
    return myLocation.City;
    }
    }

    Thus I can databind to the City property.

    Kind regards
    Thomas
    style, Sep 15, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KJ
    Replies:
    0
    Views:
    2,317
  2. nicolas

    Hierarchical and recursive nested datagrid

    nicolas, Sep 29, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    189
    Nicolas Chevet
    Sep 30, 2003
  3. Yasir Hussain

    Nested Grids for Hierarchical Data

    Yasir Hussain, Oct 7, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    150
    Yasir Hussain
    Oct 7, 2003
  4. David Branch

    Nested Grids for Hierarchical Data

    David Branch, Dec 9, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    188
  5. Michael
    Replies:
    0
    Views:
    221
    Michael
    Dec 29, 2003
Loading...

Share This Page