Binding RadioButtonList ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ivan Demkovitch

    #1

    Binding RadioButtonList ...

    Hi!

    I wonder if thats a bug or something:

    I have an object which has arrayList of child objects exposed to clients.
    This child object also exposed to clients.

    Class A
    {
    public ArrayList CurrentList = new ArrayList();
    }

    Class B
    {
    int _DetlKey;
    string _Detl;

    public int DetlKey
    {
    get
    {
    return this._DetlKey;
    }
    set
    {
    _DetlKey = value;
    }
    }

    public string Detl
    {
    get
    {
    return this._Detl;
    }
    set
    {
    _Detl = value;
    }
    }
    }


    //code to populate array list omitted.


    Then I use this code to bind my List:

    rbList.DataSour ce = A.CurrentList;
    rbList.DataBind ();

    And I get error:

    Exception Details: System.Web.Http Exception: DataBinder.Eval :
    'ASPNetPortal.B ' does not contain a property with the name DetlLey.

    What is the problem here?

    I searched NG and came up with posts saying that properties have to be
    actual properties in classes, not fields. I changed class (it's in example)
    but steel get error.


    Any ideas?




  • Chris Jackson

    #2
    Re: Binding RadioButtonList ...

    While there are plenty of bugs in software as big as ASP.NET, it's best to
    assume that the bug is in your code until you have conclusively proven
    otherwise.

    In this case, you are throwing the error in your DataBinder.Eval call, which
    you don't show. I would step through your code to find the exact line, and
    then post what you are doing in the Eval statement to give us a feel for
    what you are doing when the error occurs. There is nothing to indicate that
    you are having a problem with the binding, at least that I can see.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --

    "Ivan Demkovitch" <i@d> wrote in message
    news:edPuqWcZDH A.2632@TK2MSFTN GP09.phx.gbl...[color=blue]
    > Hi!
    >
    > I wonder if thats a bug or something:
    >
    > I have an object which has arrayList of child objects exposed to clients.
    > This child object also exposed to clients.
    >
    > Class A
    > {
    > public ArrayList CurrentList = new ArrayList();
    > }
    >
    > Class B
    > {
    > int _DetlKey;
    > string _Detl;
    >
    > public int DetlKey
    > {
    > get
    > {
    > return this._DetlKey;
    > }
    > set
    > {
    > _DetlKey = value;
    > }
    > }
    >
    > public string Detl
    > {
    > get
    > {
    > return this._Detl;
    > }
    > set
    > {
    > _Detl = value;
    > }
    > }
    > }
    >
    >
    > //code to populate array list omitted.
    >
    >
    > Then I use this code to bind my List:
    >
    > rbList.DataSour ce = A.CurrentList;
    > rbList.DataBind ();
    >
    > And I get error:
    >
    > Exception Details: System.Web.Http Exception: DataBinder.Eval :
    > 'ASPNetPortal.B ' does not contain a property with the name DetlLey.
    >
    > What is the problem here?
    >
    > I searched NG and came up with posts saying that properties have to be
    > actual properties in classes, not fields. I changed class (it's in example[/color]
    )[color=blue]
    > but steel get error.
    >
    >
    > Any ideas?
    >
    >
    >
    >[/color]


    Comment

    • Ivan Demkovitch

      #3
      Re: Binding RadioButtonList ...

      Chris,

      Thanks for answering. Did you personally bind radiobuttonlist to ArrayList?

      I'm using WebMatrix and cannot step thru code. But error is on
      rbList.DataBind (); call

      there is no call for DataBinder.Eval in my code.

      Here is a link on a same problem in another post. Solution provided does not
      work for me.


      Thanks,
      Ivan

      "Chris Jackson" <chrisj@mvps.or g> wrote in message
      news:%23xVfJulZ DHA.2548@TK2MSF TNGP09.phx.gbl. ..[color=blue]
      > While there are plenty of bugs in software as big as ASP.NET, it's best to
      > assume that the bug is in your code until you have conclusively proven
      > otherwise.
      >
      > In this case, you are throwing the error in your DataBinder.Eval call,[/color]
      which[color=blue]
      > you don't show. I would step through your code to find the exact line, and
      > then post what you are doing in the Eval statement to give us a feel for
      > what you are doing when the error occurs. There is nothing to indicate[/color]
      that[color=blue]
      > you are having a problem with the binding, at least that I can see.
      >
      > --
      > Chris Jackson
      > Software Engineer
      > Microsoft MVP - Windows XP
      > Windows XP Associate Expert
      > --
      >
      > "Ivan Demkovitch" <i@d> wrote in message
      > news:edPuqWcZDH A.2632@TK2MSFTN GP09.phx.gbl...[color=green]
      > > Hi!
      > >
      > > I wonder if thats a bug or something:
      > >
      > > I have an object which has arrayList of child objects exposed to[/color][/color]
      clients.[color=blue][color=green]
      > > This child object also exposed to clients.
      > >
      > > Class A
      > > {
      > > public ArrayList CurrentList = new ArrayList();
      > > }
      > >
      > > Class B
      > > {
      > > int _DetlKey;
      > > string _Detl;
      > >
      > > public int DetlKey
      > > {
      > > get
      > > {
      > > return this._DetlKey;
      > > }
      > > set
      > > {
      > > _DetlKey = value;
      > > }
      > > }
      > >
      > > public string Detl
      > > {
      > > get
      > > {
      > > return this._Detl;
      > > }
      > > set
      > > {
      > > _Detl = value;
      > > }
      > > }
      > > }
      > >
      > >
      > > //code to populate array list omitted.
      > >
      > >
      > > Then I use this code to bind my List:
      > >
      > > rbList.DataSour ce = A.CurrentList;
      > > rbList.DataBind ();
      > >
      > > And I get error:
      > >
      > > Exception Details: System.Web.Http Exception: DataBinder.Eval :
      > > 'ASPNetPortal.B ' does not contain a property with the name DetlLey.
      > >
      > > What is the problem here?
      > >
      > > I searched NG and came up with posts saying that properties have to be
      > > actual properties in classes, not fields. I changed class (it's in[/color][/color]
      example[color=blue]
      > )[color=green]
      > > but steel get error.
      > >
      > >
      > > Any ideas?
      > >
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...