If you are using webforms,you can use an UpdatePanel in your webforms and giving drop downlist in the update panels..
Please find the sample code
List<Districts> list = new List<Districts>();
Districts item = new Districts();
protected void Page_Load(object sender, EventArgs e)
{
if (drd1.SelectedItem.Value == "Kerala")
{
item.sname = "Ekm";
item.id = 1;
list.Add(item);
Districts item1 = new Districts();
item1.sname = "thr";
item1.id = 2;
list.Add(item1);
}
else
{
item.sname = "Coimbatore";
item.id = 1;
list.Add(item);
Districts item1 = new Districts();
item1.sname = "Chennai";
item1.id = 2;
list.Add(item1);
}
}
public class Districts
{
public string sname { get; set; }
public int id { get; set; }
}
protected void drd1_SelectedIndexChanged(object sender, EventArgs e)
{
drd2.DataSource = list;
drd2.DataTextField = "sname";
drd2.DataValueField = "id";
drd2.DataBind();
}
and your page looks like this
<asp:ScriptManager ID="scr" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="upd" runat="server" >
<ContentTemplate>
<asp:DropDownList ID="drd1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drd1_SelectedIndexChanged">
<asp:ListItem Text="Kerala" Value="Kerala">
</asp:ListItem>
<asp:ListItem Text="TN" Value="TN"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="drd2" runat="server" Width="100"></asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>