0

我需要在 MVC3 C# 中使用 RAZOR 创建两个单选按钮。
下面显示的是预期最终结果的示例:

<input type="radio" name="set-accessibility-on" value="on">Accessibility On<br>
<input type="radio" name="set-accessibility-off" value="off">Accessibility Off

set-accessibility-on应该调用ActionResult SetAccessibilityOn()

set-accessibility-off应该调用ActionResult SetAccessibilityOff()

我怎样才能做到这一点?

4

1 回答 1

1

像这样更改标记:

<input type="radio" name="set-accessibility" value="on">Accessibility On</input>
<input type="radio" name="set-accessibility" value="off">Accessibility Off</input>

$(document).ready(function() {
    $('input[name=setaccessibility]').bind('change', function() 
    { 
        if(this.value == 'on')
        //call this one: SetAccessibilityOn() -- ajax
        else
        //call the other one: SetAccessibilityOff() -- ajax
    });
});
于 2013-01-18T09:10:54.723 回答