Re: Business objects with no properties and data binding

"Ivanoff, Alex" <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Organization FDTD
Message-ID <00b201c75cda$f2ca2b30$d85e8190$@net>
My original sample was simplified. My real object accessors are more involved (change object state). Plus, I do not like properties since they look like fields but behave like methods (Jeffrey Richter explained it great in his book "CLR via C#").


-----Original Message-----
From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Paul van Brenk
Sent: Friday, March 02, 2007 03:21
To: [email protected]
Subject: Re: [DOTNET-WEB] Business objects with no properties and data binding

Why are the objects designed this way... just asking, maybe there is
something I'm missing.

I would do this:

public class State
{
  private String _abbr;
  private String _name;

  public String Abbr
  {
        get{    return this._abbr; }
  }

  public String Name
  {
 get{    return this._name; }
  }
}

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Alex Ivanoff
Sent: Thursday, March 01, 2007 22:20
To: [email protected]
Subject: [DOTNET-WEB] Business objects with no properties and data
binding

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(r)  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.