Browse through the following links to populate the cascading drop-down list.
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
http://www.codeproject.com/KB/aspnet/CascadingDropDown.aspx
http://www.aspsnippets.com/Articles/Creating-Cascading-DropDownLists-in-ASP.Net.aspx
the code:
<table> <tr> <td>First</td> <td><asp:DropDownList ID="DDLFirst" runat="server" AutoPostBack="true" onselectedindexchanged="DDLFirst_SelectedIndexChanged"></asp:DropDownList></td> </tr> <tr> <td>Secord</td> <td><asp:DropDownList ID="DDLSecond" runat="server" AutoPostBack="true" onselectedindexchanged="DDLSecond_SelectedIndexChanged"> <asp:ListItem Text="Select" Value="Select"></asp:ListItem> </asp:DropDownList></td> </tr> <tr> <td>Thrid</td> <td><asp:DropDownList ID="DDLThird" runat="server"><asp:ListItem Text="Select" Value="Select"></asp:ListItem> </asp:DropDownList></td> </tr> </table>
// Code for protected void Page_Load (object sender, EventArgs e) {if (! IsPostBack) {// your code to bind the first drop-down list down
} } protected void DDLFirst_SelectedIndexChanged(object sender, EventArgs e) { if (DDLFirst.SelectedIndex > 0) { string FirstDDLValue = DDLFirst.SelectedItem.Value;
source share