Getting an Object Properties value...

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

    #1

    Getting an Object Properties value...

    I have a situation where I am creating a class (oValue) that contains two
    properties "Name" and "Value".

    I am using a thrid party grid control which has a DropDownList Control. The
    PopulateValueLi st function takes 3 arguments a list,the name field, and the
    value field.
    My issue outlined in the code below is that I am adding my Object reference
    to the list, and then trying to specify the text and value fields (see the
    arrow below). The problem is that when I run the page I get "oValue" for
    the display text in each row. How do I correctly reference the Name
    property, and the Value property when sending the values to the
    PopulateValueLi st function?

    Thanks!
    Ron

    Dim oList As New ArrayList

    Dim oVal As oValue

    oVal = New oValue("Full Time", "Full Time")

    oList.Add(oVal)

    oVal = New oValue("Part Time", "Part Time")

    oList.Add(oVal)



    Dim valList As Janus.Web.GridE X.GridEXValueLi stItemCollectio n

    valList = column.ValueLis t

    valList.Populat eValueList(oLis t, oVal.Name, oVal.Value) <--------------



    Public Class oValue

    Private mValue As String

    Public Property Value() As String

    Get

    Return mValue

    End Get

    Set(ByVal Value As String)

    mValue = Value

    End Set

    End Property

    Private mName As String

    Public Property Name() As String

    Get

    Return mName

    End Get

    Set(ByVal Value As String)

    mName = Value

    End Set

    End Property

    Public Sub New(ByVal id As String, ByVal name As String)

    mName = name

    mValue = id

    End Sub

    End Class


  • RobinS

    #2
    Re: Getting an Object Properties value...

    How about
    valList.Populat eValueList(oLis t, "Name", "Value")

    I think it's probably looking for the name of the property
    you are trying to bind to.

    Robin S.
    ----------------------------------

    "RSH" <way_beyond_oop s@yahoo.comwrot e in message
    news:%23mvgb8tH HHA.924@TK2MSFT NGP02.phx.gbl.. .
    >I have a situation where I am creating a class (oValue) that contains
    >two properties "Name" and "Value".
    >
    I am using a thrid party grid control which has a DropDownList
    Control. The PopulateValueLi st function takes 3 arguments a list,the
    name field, and the value field.
    My issue outlined in the code below is that I am adding my Object
    reference to the list, and then trying to specify the text and value
    fields (see the arrow below). The problem is that when I run the page
    I get "oValue" for the display text in each row. How do I correctly
    reference the Name property, and the Value property when sending the
    values to the PopulateValueLi st function?
    >
    Thanks!
    Ron
    >
    Dim oList As New ArrayList
    >
    Dim oVal As oValue
    >
    oVal = New oValue("Full Time", "Full Time")
    >
    oList.Add(oVal)
    >
    oVal = New oValue("Part Time", "Part Time")
    >
    oList.Add(oVal)
    >
    >
    >
    Dim valList As Janus.Web.GridE X.GridEXValueLi stItemCollectio n
    >
    valList = column.ValueLis t
    >
    valList.Populat eValueList(oLis t, oVal.Name, oVal.Value)
    <--------------
    >
    >
    >
    Public Class oValue
    >
    Private mValue As String
    >
    Public Property Value() As String
    >
    Get
    >
    Return mValue
    >
    End Get
    >
    Set(ByVal Value As String)
    >
    mValue = Value
    >
    End Set
    >
    End Property
    >
    Private mName As String
    >
    Public Property Name() As String
    >
    Get
    >
    Return mName
    >
    End Get
    >
    Set(ByVal Value As String)
    >
    mName = Value
    >
    End Set
    >
    End Property
    >
    Public Sub New(ByVal id As String, ByVal name As String)
    >
    mName = name
    >
    mValue = id
    >
    End Sub
    >
    End Class
    >
    >

    Comment

    • RSH

      #3
      Re: Getting an Object Properties value...

      Silly me!

      That was it...perfect!

      Thanks!


      "RobinS" <RobinS@NoSpam. yah.nonewrote in message
      news:K_6dnYvlL9 qKCB3YnZ2dnUVZ_ umlnZ2d@comcast .com...
      How about
      valList.Populat eValueList(oLis t, "Name", "Value")
      >
      I think it's probably looking for the name of the property
      you are trying to bind to.
      >
      Robin S.
      ----------------------------------
      >
      "RSH" <way_beyond_oop s@yahoo.comwrot e in message
      news:%23mvgb8tH HHA.924@TK2MSFT NGP02.phx.gbl.. .
      >>I have a situation where I am creating a class (oValue) that contains two
      >>properties "Name" and "Value".
      >>
      >I am using a thrid party grid control which has a DropDownList Control.
      >The PopulateValueLi st function takes 3 arguments a list,the name field,
      >and the value field.
      >My issue outlined in the code below is that I am adding my Object
      >reference to the list, and then trying to specify the text and value
      >fields (see the arrow below). The problem is that when I run the page I
      >get "oValue" for the display text in each row. How do I correctly
      >reference the Name property, and the Value property when sending the
      >values to the PopulateValueLi st function?
      >>
      >Thanks!
      >Ron
      >>
      >Dim oList As New ArrayList
      >>
      >Dim oVal As oValue
      >>
      >oVal = New oValue("Full Time", "Full Time")
      >>
      >oList.Add(oVal )
      >>
      >oVal = New oValue("Part Time", "Part Time")
      >>
      >oList.Add(oVal )
      >>
      >>
      >>
      >Dim valList As Janus.Web.GridE X.GridEXValueLi stItemCollectio n
      >>
      >valList = column.ValueLis t
      >>
      >valList.Popula teValueList(oLi st, oVal.Name, oVal.Value) <--------------
      >>
      >>
      >>
      >Public Class oValue
      >>
      >Private mValue As String
      >>
      >Public Property Value() As String
      >>
      >Get
      >>
      >Return mValue
      >>
      >End Get
      >>
      >Set(ByVal Value As String)
      >>
      >mValue = Value
      >>
      >End Set
      >>
      >End Property
      >>
      >Private mName As String
      >>
      >Public Property Name() As String
      >>
      >Get
      >>
      >Return mName
      >>
      >End Get
      >>
      >Set(ByVal Value As String)
      >>
      >mName = Value
      >>
      >End Set
      >>
      >End Property
      >>
      >Public Sub New(ByVal id As String, ByVal name As String)
      >>
      >mName = name
      >>
      >mValue = id
      >>
      >End Sub
      >>
      >End Class
      >>
      >>
      >
      >

      Comment

      Working...