この方法で追加されたドロップダウン リストに 1 つ以上のイベントを追加する方法
@Html.DropDownList("リスト") ?
jQuery: の使用に慣れている場合は、これを試してください。
$("#DropDownListID").change(function () {
var selectedValue = $(this).val();
//Do whatever you want to do on selection changes here
});
@Html.DropDownList("PageItemDD", (SelectList)ViewBag.itemsPerPage, new { onchange = "document.location.href = '/List?ipp=' + this.options[this.selectedIndex].value;" })
部分 (DropDownListのnew { onchange = "document.location.href = '/List?ipp=' + this.options[this.selectedIndex].value;" }
3 番目のパラメーター) は、html 属性です。この場合、onchange
このページをロードする があります。/List?ipp= the value of the dropdownlist