0

C# コード ビハインドで DropDownList のインデックスを選択しようとしていますが、SelectedIndexChanged イベントが発生しません。それを行う正しい方法は何ですか?

  DropDownListChapterTitles.SelectedIndex = 1;


  protected void DropDownListChapterTitles_SelectedIndexChanged(object sender, EventArgs e)
  { }
4

2 に答える 2

0
DropDownListChapterTitles.SelectedIndex = 1;
// Call it yourself
DropDownListChapterTitles_SelectedIndexChanged(this, null);
于 2012-10-06T14:36:38.053 に答える
0

マークアップを確認すると、次のようになります

<asp:DropDownList runat="server" ID="DropDownListChapterTitles" AutoPostBack="True"
     OnSelectedIndexChange="DropDownListChapterTitles_SelectedIndexChanged">

</asp:DropDownList>

追加したOnSelectedIndexChange="DropDownListChapterTitles_SelectedIndexChanged"

于 2012-10-06T15:03:06.897 に答える