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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:55:53+00:00 2026-05-14T05:55:53+00:00

I am trying to work with an HTML.DropDownList in MVC and am not getting

  • 0

I am trying to work with an HTML.DropDownList in MVC and am not getting the expected return values. Here is my implementation for the selectList to bind to the drop down –

IEnumerable<status> stat = _provider.GetAllStatuses();
Statuses = new SelectList(stat.ToList(), "id", "name", i.status.id);

And here is my view –

<%= Html.DropDownList("Status",Model.Statuses) %>

I am getting an error when trying to run updatemodel in my controller. I then tried to individually set each object. It turns out that I am not getting a single int from the formvalue as I would expect to. Instead, I am getting a value like “5,10,2,3”. I think this is coming from how I set up my selectlist, but I’m not exactly sure. Can anyone see an error in the way I am setting up this dd?

Thanks for any help, and let me know if I can clarify anything.

  • 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-14T05:55:54+00:00Added an answer on May 14, 2026 at 5:55 am

    What does the signature of the post method look like? It (or the model) should have a Status property that’s defined as an int. I suspect that you’ve got more code than you’re showing us that is listing all the potential statuses on the page (hidden fields?) and that’s what you are seeing posted back as an array of ints.

    It should look something like:

     public ActionResult PostAction( int status, .... )
     {
       ... status will contain the selected value from the dropdown ...
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do work with examples on Trees as given here: http://cslibrary.stanford.edu/110/BinaryTrees.html
Im trying to work out how to take form field values and selected drop
Hi I'm trying to fix a bit of test html to work with opera/chrome.
Programming Student here...trying to work on a project but I'm stuck. The project is
I'm trying to work out how to load a module using example http://dojotoolkit.org/reference-guide/dojo/registerModulePath.html I
I'm trying to work with mytablegrid . There is a working example here On
Trying to work with ImageField in django. Here are my models class Album(models.Model): title
Im trying to work with following code i getting this error at xsltProcessor.importStylesheet Error
Ok so here is my problem. I'm trying to populate an @Html.DropDownListFor() with my
Possible Duplicate: How can I get this ASP.NET MVC SelectList to work? What the

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.