我有ddlModalityList下拉列表..选择ddlModalityList ..我必须在另一个下拉列表中填充相应的选定研究。
protected void Page_Load(object sender, EventArgs e)
{
var dictionery = new Dictionary<int, string>();
foreach (DataRow dr in dataTableAcqModality.Rows)
{
ModalityID = Convert.ToInt32(dr["Modality_ID"]);
strModality = dr["Modality"].ToString();
strSchStaAETitle = dr["Scheduled_Station_AE_Title"].ToString();
strSchStaName = dr["SCHEDULED_STATION_NAME"].ToString();
strDdlModality = strModality + "(" + strSchStaAETitle + "|" + strSchStaName + ")";
dictionery.Add(ModalityID, strDdlModality);
}
ddlModalityList.DataTextField = "Value";
ddlModalityList.DataValueField = "Key";
ddlModalityList.DataSource = dictionery;
ddlModalityList.DataBind();
}
protected void ddlModalityList_SelectedIndexChanged(object sender, EventArgs e)
{
Dictionary<int, string> selectedPair = (Dictionary<int,string>)ddlModalityList.SelectedItem;
}
}
答案 0 :(得分:0)
protected void ddlModalityList_SelectedIndexChanged(object sender, EventArgs e)
{
ListItem selectedPair = ddlModalityList.SelectedItem;
}