I am using below code to create a drop down
Controller
ViewBag.Id= new SelectList(db.TableName.OrderBy(x => x.Name),"Id","Name")
View
@Html.DropDownList("Id", null, htmlAttributes: new { @class = "form-control" })
My question is how can I Modify SelectList
to add a blank item so that there is a blank item automatically added for DropDownList
.
Thanks.