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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:43:04+00:00 2026-05-25T03:43:04+00:00

Previously, I was using this in my model public List<SelectListItem> StatusList { get; set;

  • 0

Previously, I was using this in my model

 public List<SelectListItem> StatusList { get; set; }
 public string Status { get; set; }    

and this in my view to bind to the Dropdownlist

 @Html.DropDownListFor(model => model.Status, Model.StatusList, "")

but if I want to use

  public List<ICode> StatusList { get; set; }

where ICode is as below

 public interface ICode
{
    int Id { get; set; }
    ICodeGroup CodeGroup { get; set; }
    string ShortDescription { get; set; }
    string LongDescription { get; set; }
}

What should I do in my view and model?

  • 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-25T03:43:04+00:00Added an answer on May 25, 2026 at 3:43 am

    Cybernate’s solution works. You could also do:

    @Html.DropDownListFor(model => model.Status, 
         new SelectList(Model.StatusList, "Id", "ShortDescription"))
    

    Cybernate’s version will do stronger type checking, but SelectList is more encapsulated.

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

Sidebar

Related Questions

I have list of items with check boxes using this code: ProcessList = (ListView)
In a project using NHibernate, I have this class : public class AdminVAT :
I am currently using/experimenting with autofac as my IoC controller. Previously to this I
Apologies if this is a dumb question. In previous ASP.NET projects, I've been using
previously i was using picture box and its built in utilities to draw some
Jeff has previously blogged about using the cache to perform "out of band" processing
I'm developing a graph control in WPF. I have previously developed it using GDI
Previously when I browsed source code files using Xcode's file browser (located on left
Previously within my Fitnesse fixture I was specifying an expected WCF exception using: exception[FaultException]
Previously, I am using STL map to perform the mentioned task. struct ltstr {

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.