我有一个ListBox
控件,我试图向其中添加值,然后稍后检索键/值。当我添加多个项目时,它会覆盖我之前添加的值。有人可以对此有所了解吗?
var holder = new Dictionary<int, string>();
holder.Add(Int32.Parse(cmb_AgencyList.SelectedValue.ToString()),
cmb_AgencyList.Text);
lb_AgenciesAdded.DataTextField = "Value";
lb_AgenciesAdded.DataValueField = "Key";
lb_AgenciesAdded.DataSource = holder;
lb_AgenciesAdded.DataBind();