我有以下代码创建一个下拉列表.
当用户选择一个项目时,我想在控制器中调用某个动作并将新值作为参数传递.
我有以下代码,但这不起作用,当我检查Firebug时,我得到"无效的正则表达式C".
@Html.DropDownList(
"ctrlName",
items,
null,
new { onchange = "document.location.href = /Controller/Action/this.options[this.selectedIndex].value;" })
Run Code Online (Sandbox Code Playgroud)
你在js中缺少引号
@Html.DropDownList(
"ctrlName",
items,
null,
new { onchange = "document.location.href = '/Controller/Action/' + this.options[this.selectedIndex].value;" })
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9250 次 |
| 最近记录: |