Getting an Object Properties value...

R

RSH

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
PopulateValueList 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
PopulateValueList 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.GridEX.GridEXValueListItemCollection

valList = column.ValueList

valList.PopulateValueList(oList, 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
 
R

RobinS

How about
valList.PopulateValueList(oList, "Name", "Value")

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

Robin S.
 
R

RSH

Silly me!

That was it...perfect!

Thanks!


RobinS said:
How about
valList.PopulateValueList(oList, "Name", "Value")

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

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top