Re: Business objects with no properties and data binding
"Ivanoff, Alex" <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Organization | FDTD |
| Message-ID | <00b101c75cda$69abef50$3d03cdf0$@net> |
This is what I ended up doing. This is unfortunate that you cannot bind to methods. -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Efran Cobisi Sent: Friday, March 02, 2007 02:20 To: [email protected] Subject: Re: [DOTNET-WEB] Business objects with no properties and data binding Hi, Afaik this is not possible, because bound values are gathered using the System.Web.UI.DataBinder:GetDataItem() method, which expects public properties. You could, however, write a proxy for your object, which could abstract the logic required to access data in your object, allowing to retrieve using public properties. HTH, Efran Cobisi http://www.cobisi.com Alex Ivanoff wrote: > Is it possible to data bind a web control (DropDownList) to a list of > business objects which do not have properties but accessor methods instead: > > public class State > { > private String _abbr; > private String _name; > > public String GetAbbr() > { > return this._abbr; > } > > public String GetName() > { > return this._name; > } > } > > Thank you, > Alex > > =================================== > This list is hosted by DevelopMentor® http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com