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

  • Home
  • SEARCH
  • 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 6922511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:24:56+00:00 2026-05-27T10:24:56+00:00

I have follwoing code @Html.DropDownList(optionsforuser, new SelectList(new[] { Option1, Option2, Option3 }), Select) Is

  • 0

I have follwoing code

@Html.DropDownList("optionsforuser", new SelectList(new[] { "Option1", "Option2", "Option3" }), "Select")

Is there anyway to initialize a value of 100 for Option1, 200 for Option2, 250 for Option3 etc within SelectList?

  • 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-05-27T10:24:56+00:00Added an answer on May 27, 2026 at 10:24 am

    Try using this Extension:

    @Html.DropDownList("optionsforuser", 
        new SelectList(new Dictionary<string, int> 
            {
                {"Option1", 100},
                {"Option2", 200},
                {"Option3", 250}
            },
            "Value", "Key")
    )
    

    and pass it a Dictionary<string, int> with the dataValueField and dataTextField populated with your values and text


    SelectExtensions.DropDownList Method (HtmlHelper, String, IEnumerable(Of SelectListItem))

    public static MvcHtmlString DropDownList(
        this HtmlHelper htmlHelper,
        string name,
        IEnumerable<SelectListItem> selectList
    )
    

    SelectList Constructor (IEnumerable, String, String)

    public SelectList(
        IEnumerable items,
        string dataValueField,
        string dataTextField
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have follwoing code @Html.DropDownList(optionsforuser, new SelectList(new[] { Option1, Option2 }), Select) Now i
I have the following code- View- <% Html.BeginForm(); %> <div> <%= Html.DropDownList(DropDownSelectList, new SelectList(
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have a drop down list like so: <%= Html.DropDownList(SoldTo, Model.SellDealerList, Select a Dealer)%>
I have following code in my MVC2 view: <tr class=edit style=display:none> <td> <%= Html.DropDownList(drpFields,
I have following code in my MVC2 view: <tr class=edit style=display:none> <td> <%= Html.DropDownList(drpFields,
I have the following html code <select id=WageBenifits_PayType name=WageBenifits.PayType> <option class=selectOption value= selected=selected>Please Select
I have the following code: int StatusID = ViewBag.DefaultStatus.StatusID; List<NEOGOV_Ideas.Models.Status> statusList = ViewBag.StatusList; @Html.DropDownList(DefaultStatus,
I have the following code: HTML: //forLoop (users) <b>UserName</b> <select id = select-dropdown onclick=showOptions()>
I have the following code in html, I cannot get the Function call back

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.