CheckBox

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have an enumeration:

' Level
Public Enum Level
Professor
Student
' ...
End Enum ' Level

And a property of type Level:

' Levels
Private _Levels As Generic.List(Of Level)
Public Property Levels() As Generic.List(Of Level)
Get
Return _Levels
End Get
Set(ByVal value As Generic.List(Of Level))
_Levels = value
End Set
End Property ' Levels

I need to display, in my web page, N CheckBoxes which one showing a
Level.

Then I want to check the CheckBoxes which value exists in the property
Levels (Generic List).

How can I do this?

Thanks,

Miguel
 
shapper said:
Hello,

I have an enumeration:

' Level
Public Enum Level
Professor
Student
' ...
End Enum ' Level

And a property of type Level:

' Levels
Private _Levels As Generic.List(Of Level)
Public Property Levels() As Generic.List(Of Level)
Get
Return _Levels
End Get
Set(ByVal value As Generic.List(Of Level))
_Levels = value
End Set
End Property ' Levels

I need to display, in my web page, N CheckBoxes which one showing a
Level.

Then I want to check the CheckBoxes which value exists in the property
Levels (Generic List).

How can I do this?

Thanks,

Miguel

Loop through the values in the enum:

ForEach levelItem As Level in Enum.GetValues(GetType(Level))
...
Next

(I am not sure about the GetType(Level) part, that is supposed to return
the type of the enum.)

The levelItem variable will contain each of the values, so that you can
create a control for each of them and add it to the page. You can use
levelItem.ToString() to get the level value as a string so that you can
construct a unique id for each control.

You can use the Contains method on the list of levels to determine if a
specific level value exists in the list.
 
Back
Top