Question: I am new to mvc and i need some help.
 I have this model class:

```
Public Class PostCategories

Public Property ID() As Integer

Public Property Name() As String

Public Property Slug() As String

Public Property ParentID() As Integer

```

and I have this dropdownlist in my view:

```
 @Html.DropDownList("IDList", New SelectList(Model, "Id", "ID"), "Selected Parent")

```

Instead of ID, I'd like to put the Name in the dropdownlist and save the ID to the db. How am i supposed to do it? Need help pls.

Answer: 
Assuming your View Model is a list of PostCategories then just use:

```
@Html.DropDownList("IDList", New SelectList(Model, "ID", "Name"), "Selected Parent")

```
As Beyers said, it should be sufficient to change your code to

```
@Html.DropDownList("IDList", New SelectList(Model, "ID", "Name"), "Selected Parent")

```

where the second parameter of the SelectList constructor is the value of the selected item you want to be passed upon form submit, and must reflect the name of one of your Model properties, therefore must be "ID" and not "Id".
The second parameter is the item's name displayed in the dropdown, in this case you should use "Name" as it's probably the property you want to use.
Optionally you can pass in a fourth parameter that is the selected value at page load time.

Another approach would be to build your SelectList in the controller and pass it using the ViewBag like this: 

```
ViewBag.PostCategoriesId = new SelectList(yourPostCategoriesList, "ID", "Name");

```

and then in the View your code would be like: 

```
@Html.DropDownList("PostCategoriesId", string.Empty)

```