1
我無法調用我在Razor代碼中編寫的函數,我將參數傳遞給控制器。MVC從剃刀代碼調用Javascript func
任何人有任何想法?
mycode的:
<script type="text/javascript">
function GetDropDownValue(ControlId) {
var list = document.getElementById(ControlId);
return list.options[list.selectedIndex].value;
}
@Html.DropDownList(
"TransactionType",
new SelectList(Enum.GetValues(typeof(Forex.Reports.ReportValueType))),
"Transaction Type",
new
{
@class = "form-control",
@id = "type"
})
//This is the parameter where I try to invoke the Javascript func
@using (Html.BeginForm("MonetaryTransactions", "Trading",new { type =
"GetDropDownValue('type')" }))
{
<input type="submit" value="D"/>
}
感謝, 的Yaniv
你想獲得選擇表單提交下拉項目? –