S
Sreenivas Chaithanya
Guest
Here is the sample code i tried to bind to other checkboxlist from the items checked in the first checkboxList
void binddatatolist()
{
string s = "SELECT DISTINCT ************************************************************* ";
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.Selected)
// {
// Message.Text += cbl_Generaldata.Items.Text + "<br />";
// }
//}
//string SelectedText="::";
//for (int i = 0; i < cbl_Generaldata.Items.Count; i++)
//{
// if (cbl_Generaldata.GetItemChecked(i))
// {
// SelectedText = SelectedText + cbl_Generaldata.Items.Text;
// //string checkvalue = Convert.ToString(cbl_Generaldata.Text);
// //cblSelectedList.Items.Add(checkvalue);
// ////s += Chkboxlist.Items.Value + ";";
// }
// if (cbl_Generaldata.GetItemChecked(i))
// {
// string str = cbl_Generaldata.Text.ToString();
// MessageBox.Show(str);
// next line invalid extension method
// cbl_Generaldata.Items.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);
}
Continue reading...
void binddatatolist()
{
string s = "SELECT DISTINCT ************************************************************* ";
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.Selected)
// {
// Message.Text += cbl_Generaldata.Items.Text + "<br />";
// }
//}
//string SelectedText="::";
//for (int i = 0; i < cbl_Generaldata.Items.Count; i++)
//{
// if (cbl_Generaldata.GetItemChecked(i))
// {
// SelectedText = SelectedText + cbl_Generaldata.Items.Text;
// //string checkvalue = Convert.ToString(cbl_Generaldata.Text);
// //cblSelectedList.Items.Add(checkvalue);
// ////s += Chkboxlist.Items.Value + ";";
// }
// if (cbl_Generaldata.GetItemChecked(i))
// {
// string str = cbl_Generaldata.Text.ToString();
// MessageBox.Show(str);
// next line invalid extension method
// cbl_Generaldata.Items.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);
}
Continue reading...