Asp.Net MVC Handle Drop Down Boxes that are not part of the Model
Posted
by Pino
on Stack Overflow
See other posts from Stack Overflow
or by Pino
Published on 2010-05-21T10:19:22Z
Indexed on
2010/05/21
11:00 UTC
Read the original article
Hit count: 229
I have a small form which the user must fill in and consists of the following fields.
Name (Text) Value (Text) Group (Group - Is a list of option pulled from a database table)
Now the Model for this View looks like so,
public string Name { get; set; }
public string Value { get; set; }
public int GroupID { get; set; }
Now the view is Strongly Typed to the above model.
What method would one use to populate the drop down list? Since the data is not contained within the Model (It could be contained in the Model) should we be using Temp/View data? A HTML Helper? What would be the ideal way to achieve this.
© Stack Overflow or respective owner