cannot
clear the Dropdown items on selected index changed
the items get added one below the other
protected void ddlSection_SelectedIndexChanged(object sender, EventArgs e)
{
ddlSegement.ClearSelection();
if (ddlSection.SelectedIndex == 1)
{
ddlSegement.Items.Add("Equity");
ddlSegement.Items.Add("Derivatives");
ddlSegement.Items.Add("Mutual Funds");
ddlSegement.Items.Add("FII's");
}
if (ddlSection.SelectedIndex == 2)
{
ddlSegement.Items.Add("Companies/ Securities");
ddlSegement.Items.Add("Capital listed");
ddlSegement.Items.Add("Amount offered");
ddlSegement.Items.Add("Indices");
ddlSegement.Items.Add("Ratios");
}
and ASpx page code is
<tr><td >Select Section</td><td colspan="3"><asp:DropDownList ID="ddlSection" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlSection_SelectedIndexChanged" >
<asp:ListItem Value="0" Selected="True" >Select</asp:ListItem>
<asp:ListItem Value="1" >Turnover Satistics</asp:ListItem>
<asp:ListItem Value="2">Listing and Captial</asp:ListItem>
<asp:ListItem Value="3">Membership and TWS</asp:ListItem>
<asp:ListItem Value="4">Client Statistics</asp:ListItem>
</asp:DropDownList></td></tr>
<tr ><td >Select Segement</td><td colspan="3"><asp:DropDownList ID="ddlSegement" runat="server" AutoPostBack="true" >
</asp:DropDownList></td></tr>