我的布局中有这个按钮,通过点击事件改变了价值:
yum install php70w php70w-mysql php70w-common php70w-xml php70w-mbstring
我需要将按钮的值发送到我的控制器,以便在条件下使用它:
<input type="button" id="switchbutton" value="Weekend" style="color:blue" onclick="toggle(this);">
<script type="text/javascript"></script>
<script>
function toggle(button) {
switch (button.value) {
case "Weekend":
button.value = "Week";
break;
case "Week":
button.value = "Weekend";
break;
}
return value;
}
</script>
你能帮我把布局上按钮的值发送给我的控制器吗?
答案 0 :(得分:0)
您应该能够在表单上获得与视图类似的值。
public ActionResult Edit([Bind(Include = "switchbutton")] YourModel yourModel){
string myValue = yourModel.switchbutton;}