Home DropDownList Dropdownlist OnSelectedIndexChanged
09.09.2010
Main Menu
Programming
.NET Controls
Operating System
Databases
Articles
Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: StumbleUpon Add to: Slashdot Add to: Yahoo Add to: Technorati Add to: Google
Dropdownlist OnSelectedIndexChanged

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();

}



Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."