0

I have the following simple DDL in my ASP.NET page:

<asp:DropDownList runat="server" ID="ddlTSAG" AutoPostBack="true" OnSelectedIndexChanged="ddlTSAG_SelectedIndexChanged">
  <asp:ListItem Value="0" Text="0" />
  <asp:ListItem Value="1" Text="1" />
  <asp:ListItem Value="2" Text="2" />
  <asp:ListItem Value="3" Text="3" />
  <asp:ListItem Value="4" Text="4" />
  <asp:ListItem Value="5" Text="5" />
  <asp:ListItem Value="6" Text="6" />
  <asp:ListItem Value="7" Text="7" />
  <asp:ListItem Value="8" Text="8" />
  <asp:ListItem Value="9" Text="9" />
  <asp:ListItem Value="10" Text="10" />
</asp:DropDownList>

And in my codebehind:

protected void ddlTSAG_SelectedIndexChanged(object sender, EventArgs e) {
   _tSAGChanged = true;
}

The SelectedIndexChanged fires as expected in all cases except one: when the DDL goes from a nonzero index back to 0. For example, if I click the DDL and choose 4, it works as expected and SelectedIndexChanged fires. But when I change the DDL selection from 4 back to 0 SelectedIndexChanged does not fire. This is 100% reproducible and consistent. I can set a breakpoint to prove this, I'm not merely relying on the value of _tSAGChanged. When going back to 0, my breakpoint is never hit, and _tSAGChanged does not become true.

Note: I tried adding EnableViewState="true" to my DDL but that had no effect.

Why is this happening?

HerrimanCoder
  • 6,835
  • 24
  • 78
  • 158

0 Answers0