The OnSelectedIndexChanged occurs and gets fired when the user is selecting a different item in the dropdownlist. You can registered the event on the ASPX page or behind code.

If you are experiencing that the event does not get fire then make sure the AutoPostBack is set to true.

To register it on the ASPX page:

OnSelectedIndexChanged="ddlCourse_SelectedIndexChanged"

To register it from the code behind page, place this code inside the  Page_Load event block:

ddlCourse.SelectedIndexChanged += new EventHandler(ddlCourse_SelectedIndexChanged);

 
HTML File:

<asp:Panel ID="Panel1" runat="server" Visible="false">       

        <asp:DropDownList ID="ddlCourse" runat="server" AutoPostBack="true"

            OnSelectedIndexChanged="ddlCourse_SelectedIndexChanged">

            <asp:ListItem Text="Course 1" Value="Course 1"></asp:ListItem>

            <asp:ListItem Text="Course 2" Value="Course 2"></asp:ListItem>

            <asp:ListItem Text="Course 3" Value="Course 3"></asp:ListItem>

        </asp:DropDownList>       

</asp:Panel>

 

Code File:

 

void ddlCourse_SelectedIndexChanged(object sender, EventArgs e)

{

       throw new NotImplementedException();

}

 
* iOS Development * OS X * Product Review