我正在使用ASP.NET,並且我動態地填充了我的DropDownList。 這裏是我的代碼:asp.net隱藏使用javascript的下拉列表中的具體項目
DataTable dtList = new DataTable();
dtList.Columns.Add("Name");
dtList.Columns.Add("Type");
foreach (DataDefinitionResponse dr in _dr)
{
if (dr.Type == "Dropdown")
{
string[] strSplit = dr.ListValue.Split('|');
List<string> lst = new List<string>();
foreach (string word in strSplit)
{
DataRow row = dtList.NewRow();
row["Name"] = word;
row["Type"] = dr.Name;
dtList.Rows.Add(row);
}
}
}
ddlFieldList.DataSource = dtList;
ddlFieldList.DataTextField = "Name";
ddlFieldList.DataValueField = "Type";
ddlFieldList.DataBind();
現在我只想使用Javascript選擇了其他的DropDownList時隱藏特定的項目。 我沒有在這裏使用SelectedIndexChanged。我必須使用Javascript。
請有人幫我這個。
THX