Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9144483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:16:51+00:00 2026-06-17T10:16:51+00:00

combo loads ok, but item 3 does not get selected. How can I select

  • 0

combo loads ok, but item “3” does not get selected.
How can I select this item?

Here’s the code I’m using for the list and selection.

@Code

    Dim Items As New Collections.Generic.List(Of SelectListItem)
    Items.Add(New SelectListItem With {.Value = "1", .Text = "Usuario registrado"})
    Items.Add(New SelectListItem With {.Value = "2", .Text = "Administrador"})
    Items.Add(New SelectListItem With {.Value = "3", .Text = "Supervisor"})
    Items.Add(New SelectListItem With {.Value = "4", .Text = "Usuario de pulmón"})
    Items.Add(New SelectListItem With {.Value = "5", .Text = "Usuario de picking"})

End Code


@Html.LabelFor(Function(m) m.Profile)
@Html.DropDownListFor(Function(m) m.Profile, New SelectList(Items, "Value", "Text", "3"))

Controller. In this section I initialize the profile property.

    Public Function Edit() As ActionResult
    Dim Model As New EditModel

    Dim User = Membership.FindUsersByName(Request("UserName"))(Request("UserName"))
    Model.UserName = User.UserName

    If Roles.IsUserInRole(User.UserName, Models.AppRoles.Administrador.ToString) Then
        Model.Profile = Models.AppRoles.Administrador

    ElseIf Roles.IsUserInRole(User.UserName, Models.AppRoles.Supervisor.ToString) Then
        Model.Profile = Models.AppRoles.Supervisor

    ElseIf Roles.IsUserInRole(User.UserName, Models.AppRoles.UsuarioPulmon.ToString) Then
        Model.Profile = Models.AppRoles.UsuarioPulmon

    ElseIf Roles.IsUserInRole(User.UserName, Models.AppRoles.UsuarioPicking.ToString) Then
        Model.Profile = Models.AppRoles.UsuarioPicking

    ElseIf Roles.IsUserInRole(User.UserName, Models.AppRoles.UsuarioRegistrado.ToString) Then
        Model.Profile = Models.AppRoles.UsuarioRegistrado

    End If

    Model.Email = User.Email

    Return View(Model)
End Function



Public Class EditModel

<Required()>
<Display(Name:="Perfil")>
Public Property Profile() As Models.AppRoles

<Required()> _
<Display(Name:="Nombre de usuario")> _
Public Property UserName() As String

<Required()> _
<DataType(DataType.EmailAddress)> _
<Display(Name:="E-mail")> _
Public Property Email() As String

End Class

Namespace Models
Public Enum AppRoles
    UsuarioRegistrado = 1
    Administrador = 2
    Supervisor = 3
    UsuarioPulmon = 4
    UsuarioPicking = 5
End Enum

End Namespace

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:16:53+00:00Added an answer on June 17, 2026 at 10:16 am

    You should initialize Profile property with the value you want to be selected in the list. If Profile is not an int, create a property SelectedProfileId and use this property

    @Html.DropDownListFor(Function(m) m.SelectedProfileId, New SelectList(Items, "Value", "Text"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using gtk.combo_box_new_text() to make combobox list, this uses a gtk.ListStore to store only
I did this code in my presentation layer but i don't know how to
I'm working on building a List using Combobox that when a Client is selected
I want to get some data to fill a listview control, but this data
I am using PyQt4 , but this is general enough that it could just
I want to load the combo box with XML, but I am not able
I know this seems pretty basic, and it should be, but I can't find
I have a combo box on an MVC3 application. When a new item is
I have static combo box in html with some default value already selected and
I have a html combo/select. When the user selects a element, I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.