Hi guys, i have 2 issues right now.
First, i am trying to transfer data ,populated from the database, in the listbox to a 2nd listbox. But the problem im getting now is that after i click on the button to transfer the information over, the modalpopup closes.
Secondly, after i changed the selection mode in the listbox properties. Is there some form of checkbox or something which i can select on before i transfer its data over?
Any ideas? Thank you.
Here is my code behind:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ListBox1.DataSource = mBLL.LBModule(); ListBox1.DataTextField = "ModuleName"; ListBox1.DataValueField = "ModuleCode"; ListBox1.DataBind(); } }
protected void MoveRight_Click(object sender, EventArgs e) { for (int i = 0; i < ListBox1.Items.Count;i++) { if (ListBox1.Items[i].Selected) { ListBox2.Items.Add(ListBox1.Items[i]); ListBox1.Items.RemoveAt(i); } } } protected void MoveLeft_Click(object sender, EventArgs e) { for (int i = 0; i < ListBox2.Items.Count; i++) { if (ListBox2.Items[i].Selected) { ListBox1.Items.Add(ListBox2.Items[i]); ListBox2.Items.RemoveAt(i); } } }