Databinding to custom properties of a custom class in ASP.NET 2

Discussion in 'ASP .Net' started by =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=, Apr 20, 2005.

  1. Hi there,

    Can anyone tell me how to perform two-way binding with custom properties in
    ASP.NET 2? Let's say I have a custom class called Person that I want to bind
    to a FormView (using an ObjectDataSource) for editing . The Person class
    exposes an Address property which in turn has ZipCode and City properties
    (both strings).

    How do I bind these to my FormView control? I tried Bind("Address.ZipCode")
    but I got an error stating I should bind to properties on the Person class.

    I can successfully change Bind to Eval (e.g. Eval("Address.ZipCode")) but
    then I loose the ability to update my Person class automatically as changes
    to the fields for the Address are not propagated back to my Person object.

    Is two-way data binding even possible with custom properties?

    Thanks in advance for any replies....


    Imar

    (Sorry if this isn't appopriate forum; couldn't find a specific .NET 2 forum)
    =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=, Apr 20, 2005
    #1
    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. Jason Wright via .NET 247
    Replies:
    2
    Views:
    684
    Brian W
    Jun 12, 2004
  2. Nathan Sokalski
    Replies:
    0
    Views:
    909
    Nathan Sokalski
    Oct 17, 2005
  3. jobs
    Replies:
    0
    Views:
    1,618
  4. Harlan Messinger
    Replies:
    0
    Views:
    369
    Harlan Messinger
    Feb 18, 2008
  5. Earl Teigrob
    Replies:
    1
    Views:
    401
    Shravan
    Mar 1, 2004
Loading...

Share This Page