CheckBox

Discussion in 'ASP .Net' started by shapper, Jun 12, 2007.

  1. shapper

    shapper Guest

    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, Jun 12, 2007
    #1
    1. Advertising

  2. shapper wrote:
    > 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.

    --
    Göran Andersson
    _____
    http://www.guffa.com
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jun 12, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    0
    Views:
    577
    tshad
    Apr 15, 2005
  2. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,429
    ThunderMusic
    Jan 25, 2006
  3. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    863
    David Wier
    Oct 6, 2006
  4. Jason Huang
    Replies:
    0
    Views:
    583
    Jason Huang
    Jun 29, 2007
  5. Joey Pang
    Replies:
    4
    Views:
    561
    Joey Pang
    Jun 13, 2005
Loading...

Share This Page