显示/隐藏部分基于单选按钮的选择
本文关键字:单选按钮 选择 隐藏部 显示 | 更新日期: 2023-09-27 18:11:08
我正在做一个ASP。NET MVC 4 web应用程序。我有一个视图,其中一些部分应该显示/隐藏基于一个单选按钮列表(3个单选按钮a), B), C)的选择。似乎没有办法做到这一点,而不使用jquery/javascript ?
根据这个帖子:
MVC中RadioButtonFor的Postback
"There is no server side event occurring when the user changes the selection of a radio button."
我可以执行回发与我的单选按钮和显示/隐藏部分基于选择?
请,让我知道如果没有javascript和纯ASP可以做到。. NET MVC 4+代码
控制器代码:
[HttpPost]
public ActionResult SaveIndex()
{
return View();
}
下面是view的代码:
<div>
@using (Ajax.BeginForm("SaveIndex", "Home", new AjaxOptions { HttpMethod = "Post"}, new { id = "MainForm" }))
{
@Html.RadioButton("My Radio1", "Radio1", new { onchange = "this.form.submit();" })
@Html.RadioButton("My Radio2", "Radio2", new { onchange = "this.form.submit();" })
}
</div>