2011-06-20 8 views
17
<asp:DropDownList runat="server" ID="myListDropDown" CssClass="text" OnSelectedIndexChanged="myListDropDown_Change" /> 

C#のドロップダウンリスト変更イベント

protected void myListDropDown_Change(object sender, EventArgs e) 
     { 
      //stuff that never gets hit 
     } 

上記のaspxがあります私はmyListDropDown法にブレークポイントを置くが、それはヒットれることは決してありません。助言がありますか?

+0

これは 'myListDropDown_SelectedIndexChanged()'にする必要があります。ここをクリックhttp://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist_events.aspx – Rahul

+0

@Rahulイベントハンドラの名前は関係ありません。 –

+0

@Rahul myListDropDown_SelectedIndexChanged()は意味がありますが問題ではありません。しかし、あなたの参加に感謝します。 –

答えて

24

DropDownListコントロールのAutoPostBackプロパティをtrueに設定します。

<asp:DropDownList AutoPostBack="true" runat="server" ID="myListDropDown" 
       CssClass="text" OnSelectedIndexChanged="myListDropDown_Change" /> 
+0

ありがとうございました:D Much –

5

DropDownListのAutopostbackプロパティを 'true'に設定する必要があります。

関連する問題