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 8296379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:58:15+00:00 2026-06-08T14:58:15+00:00

I want to add a dropdownlist in my form, with 2 values userid and

  • 0

I want to add a dropdownlist in my form, with 2 values userid and username in my dropdownlist, and also I want to get the value selected by the user when I click the button. I’m new to MVC and so far, I have not worked on dropdownlist, tried few samples but nothing seems to be working the way I want.

  • 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-08T14:58:18+00:00Added an answer on June 8, 2026 at 2:58 pm

    I’ll jump lots of MVC3 concepts. If you’re really new to ASP.NET MVC, you should take a look at some tutorials.

    This code should help you:

    VIEW

        @using (Html.BeginForm("ACTION NAME", "CONTROLLER NAME"))
        {
            <select name="select">
                <option value="username" selected>User name</option>
                <option value="userid">User id</option>
            </select>
            <input type="submit" />
        }
    

    ACTION

    [HttpPost]
    public ActionResult ACTIONNAME(string select)
    {
        //...
    }
    

    Please, note:

    • ACTION NAME and CONTROLLER NAME at the BeginForm helper. You will have to modify this at your code
    • The select name (“select”) and the name of the argument at the action (“select”). This is not a coincidence, it’s a convention. MVC uses the name attr to bind data
    • The selected attribute at the option will make it the default option

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dropdownlist.I want to add selected value of it to a hyperlink
I want add new Feed item on entity persist and update. I write this
I have a list of string values that I want add to a hashtable
I create a combobox in a class and want to set the selected value
I have a situation when I want to change the selected value of a
I have a form to which I want to add extra fields depending on
I am developing an MVC 3 project and want to add a user to
I want to add a dropdownlist to every entry in a gridview. <asp:GridView ID=GridView1
I want to do the following: 1: Add two dropdown list in the register.aspx
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but

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.