Q: mvc 4 dropdownlist with categories How can I insert a dropdownlist with categories in my View?
I have model
public class IdeaModel
{
    [Required]
    [Display(Name = "Idea tilte")]
    [StringLength(250, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
    public string IdeaTilte { get; set; }

    [Required]
    [Display(Name = "CategoryName")]
    public string CategoryName { get; set; }

    [Required]
    [Display(Name = "CategoryID")]
    public int CategoryID { get; set; }

    [Display(Name = "Main content")]
    [DataType(DataType.MultilineText)]
    [StringLength(1000, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 30)]
    public string Content { get; set; }
}

My view (I want one dropdownlist, instead of TextBoxFor CategoryName and CategoryID)
@model TakesCare.Models.IdeaModel



<section id="">
@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary()
    @ViewBag.Status


    <fieldset>
        <legend>Add an idea</legend>
        <ol>
            <li>
                @Html.LabelFor(m => m.IdeaTilte)
                @Html.TextBoxFor(m => m.IdeaTilte)
            </li>
            //one dropdownlist, instead of TextBoxFor CategoryName and CategoryID
            <li>
                @Html.LabelFor(m => m.CategoryName)
                @Html.TextBoxFor(m => m.CategoryName)
            </li>
            <li>
                @Html.LabelFor(m => m.CategoryID)
                @Html.TextBoxFor(m => m.CategoryID)
            </li>*@
            <li>
                @Html.LabelFor(m => m.Content)
                @Html.EditorFor(m => m.Content)
            </li>
        </ol>
        <input type="submit" value="AddIdea" />
    </fieldset>
}
</section>

I have categories:

"Cat1", id=1
"Cat2", id=2
"Cat3", id=3

My first question is - where shall I store this data? (category name and ID)
In my IdeaModel?
Second question is - how to display in dropdownlist all of my categories- then, how to get ID value in HttpPost from this dropdownlist ? What is the simplest solution?

A: You can also have a table in database to store your dropdownlist access the table  (OR)
Define a Model property as Categories in your Model like this:
public IEnumerable<SelectListItem> Categories
        {
            get
            {
                return new[]
                {
                    new SelectListItem { Value = "1", Text = "Cat1"},
                    new SelectListItem { Value = "2", Text = "Cat2" },
                    new SelectListItem { Value = "3", Text = "Cat3" }
                };
            }
        }

Now in your view you should access with Html.DropdownlistFor
@Html.DropDownListFor(m=>m.CategoryID ,Model.Categories)

When you post the data, you will recieve your id in CategoryId property of the MOdel

A: I suggest you create a SelectList in ViewBag, which you can call to populate your drop-down ... it would display your category names and return your category IDs.
in controller:
var categories = db.IdeaModel.OrderBy(CategoryName);
SelectList categoryList = new SelectList(categories, "CategoryId", "CategoryName");
viewBag.categoryList = categoryList;

in the view:
@Html.DropDownListFor(m=>m.CategoryId, @ViewBag.categoryList)

