<asp:DropDownList ID="ddlCity" runat="server" DataValueField="Id" DataTextField="Name"
OnSelectedIndexChanged="ddlCity_SelectedIndexChanged" AutoPostBack="true" >
</asp:DropDownList>
OnSelectedIndexChanged="ddlCity_SelectedIndexChanged" AutoPostBack="true" >
</asp:DropDownList>
protected void ddlCountry_ SelectedIndexChanged
(object sender, EventArgs e)
{
if (ddlCountry.SelectedValue == "0")
{
ddlCity.Items.Clear();
ddlCity.BindDataSource(null, "Select");
}
else
{
var city = (from c in "collection or list" select new
{ Id = c.Id, Name = c.Name }).ToList();
ddlCity.BindDataSource(city, "Select");
}
}
No comments:
Post a Comment