I'm trying to call "demo" function from @onchange event, The function is declared inside @functions{} section. When the event is triggered it says "demo" is not defined.
Is anyone have any idea ?
MyCode:
@Html.DropDownList("TransactionType",
new SelectList(Enum.GetValues(typeof(Forex.Reports.ReportValueType))),
"Transaction Type",
new
{
@class = "form-control",
@id = "type",
@onchange = "@demo(GetDropDownValue('type'))"
}
)
@functions{
public void demo (string selectedValue)
{
IEnumerable<Mt4Transaction>
results =
from result in Model
select result;
switch (selectedValue)
{
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;
}
Html.RenderPartial("MonetaryTransactionsPartial", results);
}
Thanks, Yaniv