我在 asp.net 中创建一个网站,我有 2 个列表框:
lbxPlayer1 and lbxPlayer2
lbxPlayer1.Items.Add("bob");
lbxPlayer1.Items.Add("jack");
lbxPlayer1.Items.Add("sam");
lbxPlayer2.Items.Add("fred");
lbxPlayer2.Items.Add("brian");
lbxPlayer2.Items.Add("dave");
它们都填充了相同数量的值,我希望这样当单击其中一个列表时,另一个列表将选择相同的索引。
我该怎么做呢?我假设代码将在 lbxPlayer1_SelectedIndexChanged 事件中?
所以当我点击“jack”时,我希望“Brian”也被选中。