Possible solution to SelectedIndexChanged firing twice

Mar 11, 2015 at 6:24 PM
Edited Mar 11, 2015 at 6:26 PM
I am using ASP.NET in Visual Studio 2010 with .NET 4.0, so I don't know if this works for other things. In regards to the issue of it firing twice I basically remove the event handler after it's use. So what I have essentially is...
protected void myDropDownCheckBoxes_SelectedIndexChanged(object sender, EventArgs e)
{
    myDropDownCheckBoxes.SelectedIndexChanged -= new System.EventHandler(this.myDropDownCheckBoxes_SelectedIndexChanged);
    //Do other stuff, for me it's looking at the itemcollection and checking which items are "selected" 
}
Why? Just from googling, not my investigate discoveries, the DropDownCheckBoxes control contains two children controls, a dropdownlist control and checkbox controls. Each of these is apparently responsible for firing off the event, hence why there are two. Again, these are other people on the internet saying this and I am still a novice in regards to how ASP.NET does a lot of stuff under the hood.

My settings for the control are
<asp:DropDownCheckBoxes ID="ddcbBlah" runat="server" UseButtons="True"     OnSelectedIndexChanged="ddcbCodeVersion_SelectedIndexChanged" Font-Size="Larger" UseSelectAllNode="true" >