How can I create my own SelectList with values of “00” and “” in C# for MVC?
问题 I have the following code in my action: ViewBag.AccountId = new SelectList(_reference.Get("01") .AsEnumerable() .OrderBy(o => o.Order), "RowKey", "Value", "00"); and in my view: @Html.DropDownList("AccountID", null, new { id = "AccountID" }) Now I would like to create the list dynamically so in my action I would just like to hardcode a simple SelectList with the values: 00 and "" so that when I go to my view I see just a blank select box. Can someone explain how I can do this in C#. 回答1: In