asp.net.ph

ListControl.SelectedIndexChanged Event

System.Web.UI.WebControls Namespace   ListControl Class


Occurs when the selection on the list changes and is posted back to the server.

[ VB ]
Public Event SelectedIndexChanged As EventHandler

[ C# ]
public event EventHandler SelectedIndexChanged;

[ C++ ]
public: __event EventHandler* SelectedIndexChanged;

In [ JScript ], you can handle the events defined by a class, but you cannot define your own.

Event Data

The method assigned to handle the event is passed an EventArgs object containing data related to the SelectedIndexChanged event.

Remarks

This event is raised whenever the selection from a list control changes and is posted back to the server.

This event is typically used in conjunction with the AutoPostBack property of the control, to automatically submit the Web Form back to the server when a user changes the selection from the list.

For more information about handling events, see Web Forms Events Model.

Example

The following example shows how to set the method that will receive control when the SelectedIndexChanged event for a DropDownList control occurs.

Select Table <asp:dropdownlist id = "tblList" datatextfield = "Table_Name" 
   autopostback onSelectedIndexChanged = "getFields" runat = "server" />

The following examples illustrate using a list control's SelectedIndexChanged event in varied scenarios.

Dynamically Retrieving Data From Any SQL Server Source
Run Sample | View Source
Using Views Example: Sales Summary
Run Sample | View Source
Custom Paging Using Primary Key Values
Run Sample | View Source
See Also

ListControl Members   SelectedIndex   AutoPostBack Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph