I am using Html.DropDownList to create an options list like so
Html.DropDownList("LogType", new SelectList(Model.LogTypeList, "ID", "Name", Model.SelectedLogType),"-- ALL --");
As you can see I pass in a list but also pass in an extra argument to add an additional option: "-- All --". The result is as follows:
<select name="LogType" id="LogType">
<option value="">-- ALL -- </option>
<option value="1">Debug</option>
<option value="2" selected="selected">Error</option>
</select>
How do I give -- All -- an value of 0 without having to manually construct the drop down list myself?
I’m not sure but, why don’t you construct the list just before your
@html.DropDownListand then append your desired item to it.
and finally pass it to your syntax and see what this will result
sorry, this is a quick answer using my iPhone, not sure if it will fix your problem, but I tried to help as much as I could.