i am inserting data in listbox1 by using this code :
if (!IsPostBack)
{
DataTable dt = new DataTable();
string query = "SELECT * FROM [Qualification]";
SqlDataAdapter objda = new SqlDataAdapter(query, conn);
//conn.Open();
objda.Fill(dt);
if (dt.Rows.Count > 0)
{
ListBox1.DataSource = dt;
ListBox1.DataTextField = "QDesc";
ListBox1.DataValueField = "QID";
ListBox1.DataBind();
}
}
and these items are going into listbox2
on button click
button click code is:
protected void Button1_Click1(object sender, EventArgs e)
{
string strItemText = "";
string strItemValue = "";
foreach (ListItem listItem in ListBox1.Items)
{
if (listItem.Selected == true)
{
strItemValue += listItem.Text;
}
}
ListBox2.Items.Add(strItemText+""+ strItemValue);
ListBox1.Items.Remove(ListBox1.SelectedItem);
}
everything is proper till here..
i want the items in listbox2
should be populated in database table....can anyone help to suggest code for same
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…