我有 2 个 HtmlSelect 控件,我需要根据第一个 HtmlSelect 的选定索引加载第二个。但它不起作用,因为 HtmlSelect 没有 selectedindexchanged 事件。我需要做什么?任何想法?
例子;
<!--These are my Html Select controls-->
select runat="server" id="drpCity"></select>
<select runat="server" id="drpState">/select>
protected void Page_Load(object sender, EventArgs e)
{
FillCities(drpCity);
FillStates(drpState, drpCity.SelectedValue);
}
public void FillCitiesHtmlSelect(HtmlSelect drpCity)
{
BusCity busCity = new BusCity();
List<EntCity> lentCity = busCity.SearchAll();
drpCity.DataValueField = EntCity.Columns.CITYCODE;
drpCity.DataTextField = EntCity.Columns.CITYNAME;
drpCity.DataSource = lentCity;
drpCity.DataBind();
drpCity.Items.Insert(0, new ListItem("City", string.Empty));
}
public void FillStatesHtmlSelect(HtmlSelect drpState, string cityCode)
{
if (!string.IsNullOrEmpty(cityCode))
{
BusState busState = new BusState();
List<EntState> lentEmsState = busState.Search(cityCode);
drpState.DataValueField = EntState.Columns.STATECODE;
drpState.DataTextField = EntState.Columns.STATENAME;
drpState.DataSource = lentState;
drpState.DataBind();
}
else
{
drpState.Items.Clear();
}
drpState.Items.Insert(0, "State", string.Empty));
}