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

G

Guest

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)
 

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
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top