私は医療用アプリケーションの開発に取り組んでいます。私はドロップダウンリストに患者名が含まれています。ドロップダウンリストをクリックすると、選択した患者のバイタルサインを示すビューにどのようにリダイレクトできますか?エンティティフレームワークを使用してデータをドロップダウンリストにバインドしました。mvc5のhtmlドロップダウンリストをクリックすると、どのように表示にリダイレクトできますか?
this is what I did.
//Controller
public ViewResult PatientLIstView()
{
PatientListdbEntities dbcontext = new PatientListdbEntities();
var getPatientlist = dbcontext.Patient_Reg.ToList();
SelectList list = new SelectList(getPatientlist, "Preg_id", "P_Name");
ViewBag.patients = list;
return View();
}
// this is the view
@{
ViewBag.Title = "PatientLIstView";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="page-content-wrapper">
<div class="page-content">
<table align="center" style="margin-top:8%;margin-left:18%">
<tr>
<td>Patient List</td>
<td>@Html.DropDownList("paients1", ViewBag.patients as SelectList,
"---select---")</td></tr>
</table>
@*@Html.DropDownList("paients1", ViewBag.patients as SelectList, "---
select---", new { style = "height: 100px;" })*@
</div>
</div>
今私は患者リストを持っています。どのように私は別のビューでそれぞれの患者の情報を表示することができるようにコントローラのドロップダウン選択値を得ることができますか?
クライアント側のイベントに応答するにはjavascriptが必要です(または、ページにリダイレクトするメソッドにフォームを送信するだけです) –