How can I retrieve selectedValue
from dropdownlist control from within the view (without storing any value in the model)?
Is there any way to do it within the Razor section?
MyCode:
<script type="text/javascript">
function dada(aa) {
return document.getElementById(aa).value;
}
</script>
@using (Html.BeginForm("MonetaryTransactions", "Trading"))
{
IEnumerable<Mt4Transaction> results = from result in Model
select result;
// This is the dropDown control which I need to get the selectedValue from ...
@Html.DropDownList("TransactionType",
new SelectList(Enum.GetValues(typeof(Forex.Reports.ReportValueType))),
"Transaction Type",
new { @class = "form-control", @id = "aa" });
switch ("???")
{
case "Withdrawal":
{
results =
from result in Model
where result.Profit > 0
select result;
}
break;
case "Deposit":
{
results =
from result in Model
where result.Profit < 0
select result;
}
break;
case "UnidentifiedProfit":
{
results =
from result in Model
select result;
}
break;
}