473,769 Members | 3,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 ObjectDataSourc e) 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.Z ipCode")
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.Z ipCode")) 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)
Nov 19 '05 #1
0 1026

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1974
by: Nic | last post by:
Hey, Is it possible to do a databinding to a function, not to a property. Ex. Object : Invoices - Invoice Each Invoice has a collection of payments (an invoice can be paied in pieces) - payment An invoice has also a function : getTotalPaid it returns a double. Now I have a datagrid (ASP) I want to bind to several propertys of Invoice but I also want to show the getTotalPaid amount and the date of the last paiement. Is that...
6
1336
by: Brad | last post by:
I have a web service which returns a collection of class object (see below). I want to consume this service in another web application by binding it to a List control The data returns from the web service, however when I bind the data I get the following error **** DataBinder.Eval: 'UserServices.User' does not contain a property with the name FirstName. **** Debugging I see that the list controls data source is a System.Array with...
2
1669
by: Jason Wright via .NET 247 | last post by:
Hiya, I've created a UserControl with some Custom properties and assigned databinding expressions to the properties in the aspx. Does anyone know why these expressions are not being evaluated? eg. <uc1:ControlX id="la" runat="server" ClientClick='javascriptfunction(<%# DataBinder.Eval(Container.DataItem, "Id")%>)' /> after processing renders in html as <table id="la" onclick="javascriptfunction(<%#...
2
1718
by: Colin Robinson | last post by:
Help please I have an example class called Person with 2 public properties Firstname and Lastname, I cant create a textbox on an asp.net form bound to the Person.Firstname property Can anyone help with the required syntax? if i do TExtbox1.text = x.firstname it works ok, but I want to edit the textbox setting the value of x.firstname.
5
3483
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object Employee that contains public properties and several nested objects such as a Spouse object and a List of Coverage objects.
8
2185
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got answered... In 1.1 we always did our own myDataAdapter.fills and we liked that control for lots of good reasons. Now the new DataSource (or is it a TableAdapter:Dataset) automatically fills the Gridview. How can we control that fill? In a...
8
2090
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the generic type Field<T> (see sample code). public class Employee { public Field<stringForename
1
1747
by: Mark Olbert | last post by:
Has anyone else noticed that the design-time support for databinding in custom controls in ASPNET2 sucks? At least for GridViews? So far I've spent going on two days trying to get the following simple statements to actually generate something at design-time: gridView = new GridView(); gridView.AutoGenerateColumns = true; gridView.DataSource = ; gridView.DataBind(); I have tried everything I could think of, or read about in four books...
2
3266
by: cjard | last post by:
I ask, because I have a textbox bound to a bindingsource, which is bound to a datatable(row) The datatable is typed, and hence exports a Property called Column1 I added another property to the datatable by editing the partial class, and Called it ColumnX - it simply returns "Hello World" all the time Then I tried to bind my textbox to it, editing the binding for .Text from xyzBindingSource - Column1
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.