I want to be able to display a dropdownlist that has values not from my database, but have hardcoded values that will be used to perform an insert query later. How would I go about doing it?
<%=Html.DropDownList("Chart Type", "Horizontal") %>
I need values Horizontal, Vertical, Pie to be in the dropdownlist.
Any help is much appreciated!
Try
<%=Html.DropDownList("Chart Type", new List<SelectListItem>
{
new SelectListItem{ Text="Horizontal", Value = "Horizontal" },
new SelectListItem{ Text="Vertical", Value = "Vertical" },
new SelectListItem{ Text="Pie", Value = "Pie" }
}) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With