1

この方法で追加されたドロップダウン リストに 1 つ以上のイベントを追加する方法

@Html.DropDownList("リスト") ?

4

2 に答える 2

2

jQuery: の使用に慣れている場合は、これを試してください。

     $("#DropDownListID").change(function () {
        var selectedValue = $(this).val();
        //Do whatever you want to do on selection changes here
     });
于 2012-06-05T09:08:29.150 に答える
1
@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

于 2012-06-05T09:07:56.737 に答える