以下に示すように、UpdatePanel に DropDownList があります。
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<div>
Index: <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
私のコードビハインドでは、この単純なコードを持っています:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillDropDownList();
}
}
private void FillDropDownList()
{
for (int i = 0; i < 10; i++)
{
DropDownList1.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
DropDownList1.SelectedIndex = 0;
Label1.Text = DropDownList1.SelectedIndex.ToString();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Label1.Text = DropDownList1.SelectedIndex.ToString();
}
問題は次のとおりです。リストで 0 より大きいアイテム (たとえば 5) を選択すると、ラベルに値 5 が表示されます。ページの html ソースを確認したところ、ドロップダウンで値 0 が選択されていましたが、5 が表示されていました。 . この問題は FireFox でのみ発生します (バージョン 3.5.7 を使用しています)。
この問題を引き起こす可能性のあるアイデアはありますか?