I'm using asp.net c# mvc4
I can currently retrieve the value of selected option in my controller from my view, but I also need to retrieve the text. My View and Controller looks like this:
View:
<form method="post" action="myAction">
<select name="sel">
<option value="1" text="One">One</option>
<option value="2" text="Two">Two</option>
</select>
</form>
Controller:
public ActionResult myAction(int sel)
{
int selValue = sel;
}
This piece of code works fie for me. However, in my controller, I want to add string selText=something so that I have the text too, and the code would look like:
public ActionResult myAction(int sel, string something)
{
int selValue = sel;
string selText = something
}
Could anyone help me with this?