我有两个强类型的部分视图(开发人员列表和测试人员列表),各自的视图是Developers.ascx和Testers.ascx
现在我想基于所选的单选按钮加载一个局部视图。 如何读取radiobutton选项的值? 如果有人能提供代码片段或一些指导,我将不胜感激。
感谢您的时间!
这是我的父控制器代码&视图:
家长控制器:
[HttpGet]
public ActionResult View IT People List(string type)
{
var developers = from d in itEntity.Developers select s;
return View(developers);
}
父视图:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Mvc.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<DataModel.Developers>>" %>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHead" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="server">
<h2>View All IT Dept List</h2>
<table>
<tr>
<td class="Form_Label"><label for="txType">Select List:</label> </td>
<td>
<%= Html.RadioButton("Type", 1, true)%> Developers <%= Html.RadioButton("Type", 2, false)%> Testers
</td>
</tr>
<tr>
<td colspan = 2>
<%Html.RenderPartial("Developers", Model);%>
</td>
</tr>
</table>
</asp:Content>
两个强类型控制器是:
[HttpGet]
public ActionResult Developers()
{
var developers = from d in itEntity.Developers select d; return View(developers);
}
[HttpGet]
public ActionResult Testers()
{
var testers = from t in itEntity.Testers select t; return View(testers);
}
由于 丽塔