I want to bind checked data from one checkboxlist to another

Feb 25 2015 11:47 AM
void binddatatolist()
{
string s = "SELECT DISTINCT application_short_name FROM fnd_application WHERE application_id IN (SELECT application_id FROM fnd_product_installations WHERE status='L')";
Cmd = new OracleCommand(s, Con);
OracleDataReader DR;
DR = Cmd.ExecuteReader();
cbl_Generaldata.Visible = true;
DataTable dataTable = new DataTable();
dataTable.Load(DR);
cbl_Generaldata.DataSource = dataTable;
cbl_Generaldata.DisplayMember = "application_short_name";
}
private void btnMovetoSelected_Click(object sender, EventArgs e)
{
//foreach(string check in cbl_Generaldata.CheckedItems)
//{
// cblSelectedList.Items.Add(check);
//}
//int i = 0;
//int k = 0;
//i = cbl_Generaldata.Items.Count;
//for (k = 0; k != i; k++)
//{
// if (cbl_Generaldata.CheckedItems == true)
// cblSelectedList.Items.Add(cbl_Generaldata.Text.ToString());
//}
//for (int k = 0; k < cbl_Generaldata.CheckedIndices.Count; k++)
//{
// cblSelectedList.Items.Add(cbl_Generaldata.Text[k]);
//}
//for (int k = 0; k < cbl_Generaldata.CheckedIndices.Count; k++)
//{
// if(cbl_Generaldata.CheckedIndices==true)
// {
// }
// //Add the retrieved item into the Listbox...
// cblSelectedList.Text=cbl_Generaldata.Text;
//}
//for (int i = 0; i < cbl_Generaldata.Items.Count - 1; i++)
//{
// if (cbl_Generaldata.Items[i].Selected)
// {
// Message.Text += cbl_Generaldata.Items[i].Text + "<br />";
// }
//}
//string SelectedText="::";
//for (int i = 0; i < cbl_Generaldata.Items.Count; i++)
//{
// if (cbl_Generaldata.GetItemChecked(i))
// {
// SelectedText = SelectedText + cbl_Generaldata.Items[i].Text;
// //string checkvalue = Convert.ToString(cbl_Generaldata.Text[i]);
// //cblSelectedList.Items.Add(checkvalue);
// ////s += Chkboxlist.Items[i].Value + ";";
// }
// if (cbl_Generaldata.GetItemChecked(i))
// {
// string str = cbl_Generaldata.Text.ToString();
// MessageBox.Show(str);
// next line invalid extension method
// cbl_Generaldata.Items[i].value;
// }
//}
//string sProductID = "";
//foreach (DataRowView view in cbl_Generaldata.CheckedItems)
//{
// if (cbl_Generaldata.CheckedItems != null)
// {
// sProductID = view[cbl_Generaldata.Items.ToString()].ToString();
// cblSelectedList.Items.Add(sProductID);
// }
//}
//foreach (ListItem item in cbl_Generaldata.Items)
//{
// if (item.Selected)
// {
// cblSelectedList.Add(item.Text);
// }
//}
// MessageBox.Show(SelectedText);
}

Answers (3)