I had doubt regarding populating all items from dropdownlistbox to list box by clicking on button in code behind using c#.
For example
As in below screenshot A,B,C,D Should be loaded to list box by clicking Submit button.

Thanks.

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sandeep ShekhawatRank #2,439 · 577 reputationPosted Jul 13, 2011, 8:08 AM EDT
protected void Button1_Click(object sender, EventArgs e)
{
foreach (ListItem li in DropDownList1.Items)
{
ListBox1.Items.Add(li.Text);
}
}
it is button click event:Button1_Click
DropDownList1 id dropdownlist id
ListBox1 listbox id
Pradeep ChandrakerRank #941 · 2.2K reputationPosted Jul 13, 2011, 5:52 PM EDT