The following dropdown does exactly what I want, but I'm looking for a simpler way to express it (note this is VB syntax).
<%=Html.DropDownList("values", CType(ViewData("values"), IEnumerable(Of SelectListItem)), "No values", New With {.onchange = "this.form.submit();"})%>
Because the ViewData value is named the same as the dropdown, the HTML helper lets the following work:
<%=Html.DropDownList("values", "No values")%>
but as soon as I try to add the onchange code:
<%=Html.DropDownList("values", "No values", New With {.onchange = "this.form.submit();"})%>
I get the "Overload resolution failed because no accessible "DropDownList" can be called without a narrowing conversion" error.
How can I take advantage of the HTML helper functionality but still specify htmlAttributes?