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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:33:24+00:00 2026-06-13T20:33:24+00:00

I’m having a problem displaying selected value with Html.DropDownListFor. I have a view that

  • 0

I’m having a problem displaying selected value with Html.DropDownListFor. I have a view that uses multiple drop downs, all of them get populated, but nothing gets selected. I have same selection choices for every dropdown, but different selected values.
Here’s my viewmodel:

public class ViewPersonTargetingViewModel
{
    public List<PersonTarget> Targets { get; set; }
    public SelectList TargetStatuses { get; set; } 
}

That’s how I make a SelectList:

var statuses = DataAccess.GetPersonTargetStatuses();
TargetStatuses = new SelectList(statuses, "PersonTargetStatusUuid", "PersonTargetStatusName");

My PersonTarget class:

public class PersonTarget
{
    public string PersonTargetStatusName { get; set; }
    public Guid PersonTargetStatusUuid { get; set; }
    //and more
}

And this is how I create a DropDownList:

<%: Html.DropDownListFor(model => model.Targets[k].PersonTargetStatusUuid, Model.TargetStatuses)%>
where k is an iteration through Targets List.

I use the same SelectList to populate all of the DropDowns, it contains info like this:

  • Text: A Value: b2e4a939-06d8-4052-8abf-5c1b2a5e8591
  • Text: B Value: 0b59faaa-514d-4212-93cd-6b0a50b8f151
  • Text: C Value: 5575f3cf-33f8-41df-be73-a176a3db5ed5

for example, when I’m trying to get it to display “B”, I give him the correct target status, but it still shows first element (“A”) as selected, I even printed out the values I give him, and I get that Model.Targets[k].PersonTargetStatusUuid has the value of: 0b59faaa-514d-4212-93cd-6b0a50b8f151 (It’s Guid of “B”), but it still displays “A”. I ran out of ideas how to fix this. Any help is greatly appreciated, thanks :).

  • 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-13T20:33:25+00:00Added an answer on June 13, 2026 at 8:33 pm

    So finally I’ve figured out that the problem lied in my single List. It turns out that for some reason, individual dropdowns must be filled from different lists. It all works now 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.