asp.net mvc - Get the display value from a DropDown -
I am trying to reach the values in the FormCollection within an action. I'm doing the pricing field:
var value = formCollection ["MyDropDownList"]; But I can not find a way to get the display value. Am I missing something obvious? Maybe a cast?
Every option is a bit tricky to get the text To capture the selected option, we use the selected index property of the selection list and then pass this value to the option []. Here is the code
var w = document.myform.mylist.selectedIndex; Var selected_text = document.myform.mylist.options [w] .text;
Comments
Post a Comment