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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:11:47+00:00 2026-06-12T16:11:47+00:00

So I have a view typed with a collection like so: <%@ Page Title=

  • 0

So I have a view typed with a collection like so:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IList<DTO.OrganizationDTO>>" %>

The OrganizationDTO looks like this:

public OrganizationDTO
{
    int orgID { get; set; }
    string orgName { get; set; }
}

I simply want to create a Drop Down List from the collection of OrganizationDTO’s using an HTML helper but for the life of me I cant figure it out! Am I going about this the wrong way?

Should I be using a foreach loop to create the select box?

  • 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-12T16:11:48+00:00Added an answer on June 12, 2026 at 4:11 pm

    I did a small example, with a model like yours:

    public class OrganizationDTO
    {
        public int orgID { get; set; }
        public string orgName { get; set; }
    }
    

    and a Controller like:

    public class Default1Controller : Controller
    {
        //
        // GET: /Default1/
    
        public ActionResult Index()
        {
            IList<OrganizationDTO> list = new List<OrganizationDTO>();
            for (int i = 0; i < 10; i++)
            {
                list.Add(new OrganizationDTO { orgID = i, orgName = "Org " + i });
            }
    
            return View(list);
        }
    
    }
    

    and in the view:

    <%= Html.DropDownListFor(m => m.First().orgID, new SelectList(Model.AsEnumerable(), "orgId","orgName")) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a strongly typed asp.net-mvc view and the Model has a . Links
i have view like 'home/details/5', it can be access by anonymous user. but there
I have traditionally implemented a Model-View-Presenter [Passive View] like so: interface IView { string
I have a complex view model which contains a collection of other objects which
When I have a DropDownList that relevant to Model of view like this: @Html.DropDownListFor(model
I have 2 forms on a page, they are included in the masterpage like
I have a strongly typed view that is using a viewmodel I created. I
I have a strong type view of type List<List<MyViewModelClass>> The outer list will always
I have a window with a main view of type NSView and a subview
I have a view model that contains a Product class type and an IEnumerable<

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.