Binding data to object and its nested object (ASP.NET 2.0)

Discussion in 'ASP .Net' started by Piotrek, Aug 3, 2006.

  1. Piotrek

    Piotrek Guest

    Hi all.

    I have a web app, in which I have object A. Object A has some
    properties plus it holds instance of object B.

    I bound object A to FormView - all its properties are properly
    displayed. However there is a problem with displaying properties of
    object B. Is there some way to bind labels to ObjectA.ObjectB.Property?
    Or do I have to make another FormView?

    Thanks in advance,
    Piotrek.
    Piotrek, Aug 3, 2006
    #1
    1. Advertising

  2. Hi
    in the label's text set the value as
    '<%=DataBinder.Eval(CType(CType(Container, DataListItem).DataItem,
    ObjectA).ObjectB, "ObjectB_Property")%>'
    --
    ---------------------------
    Thanks,
    Ibrahim

    Software Consultant - Web Development, GB


    "Piotrek" wrote:

    > Hi all.
    >
    > I have a web app, in which I have object A. Object A has some
    > properties plus it holds instance of object B.
    >
    > I bound object A to FormView - all its properties are properly
    > displayed. However there is a problem with displaying properties of
    > object B. Is there some way to bind labels to ObjectA.ObjectB.Property?
    > Or do I have to make another FormView?
    >
    > Thanks in advance,
    > Piotrek.
    >
    >
    =?Utf-8?B?SWJyYWhpbSBTaGFtZWVxdWU=?=, Aug 3, 2006
    #2
    1. Advertising

  3. Have to use formview instead of datalist in the above post
    --
    ---------------------------
    Thanks,
    Ibrahim

    Software Consultant - Web Development, GB


    "Piotrek" wrote:

    > Hi all.
    >
    > I have a web app, in which I have object A. Object A has some
    > properties plus it holds instance of object B.
    >
    > I bound object A to FormView - all its properties are properly
    > displayed. However there is a problem with displaying properties of
    > object B. Is there some way to bind labels to ObjectA.ObjectB.Property?
    > Or do I have to make another FormView?
    >
    > Thanks in advance,
    > Piotrek.
    >
    >
    =?Utf-8?B?SWJyYWhpbSBTaGFtZWVxdWU=?=, Aug 3, 2006
    #3
  4. Piotrus,
    Juz dziala wszystko?
    Patrick
    "Piotrek" <> wrote in message
    news:...
    > Hi all.
    >
    > I have a web app, in which I have object A. Object A has some
    > properties plus it holds instance of object B.
    >
    > I bound object A to FormView - all its properties are properly
    > displayed. However there is a problem with displaying properties of
    > object B. Is there some way to bind labels to ObjectA.ObjectB.Property?
    > Or do I have to make another FormView?
    >
    > Thanks in advance,
    > Piotrek.
    >
    Patrick.O.Ige, Aug 3, 2006
    #4
  5. Piotrek

    Piotrek Guest

    Hi, thanks for answers.

    I know that Eval works. However I need 2-way databinding and Eval is
    designed for 1-way.

    Piotrek.
    Piotrek, Aug 4, 2006
    #5
    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. Jordan
    Replies:
    2
    Views:
    2,519
    Jordan
    Feb 10, 2004
  2. Apple
    Replies:
    3
    Views:
    292
    Apple
    Aug 1, 2005
  3. thunk
    Replies:
    1
    Views:
    292
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    457
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    600
    thunk
    Apr 3, 2010
Loading...

Share This Page