将项目从listview复制到另一个ASP.NET中 [英] Copy items from listview to another in the same form ASP.NET
本文介绍了将项目从listview复制到另一个ASP.NET中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发销售点系统,我需要将列表视图中的数据发送到同一页面中的另一个列表视图
我尝试过:
i develope point of sale system and i need to send data from listview to another list view in the same page
What I have tried:
DataTable dt5 = (DataTable)ViewState["dt5"];
// DataTable dt6 = dt5.Clone();
// foreach (ListViewItem item in ListView1.Items)
// {
// if (((CheckBox)item.FindControl("CheckBox1")).Checked)
// {
// DataRow row1 = dt6.NewRow();
// foreach (DataRow row2 in dt5.Rows)
// {
// if (row2["productName"].ToString() == ListView1.DataKeys[item.DataItemIndex].Value.ToString())
// {
// row1["productName"] = row2["productName"];
// row1["price"] = row2["price"];
// dt6.Rows.Add(row1);
// }
// }
// }
// }
// ListView2.DataSource = dt6;
// ListView1.DataBind();
推荐答案
这可能会有所帮助..
This may assist ..
private static void MoveSelectedItems(ListView source, ListView target)
{
while (source.SelectedItems.Count > 0)
{
ListViewItem temp = source.SelectedItems[0];
source.Items.Remove(temp);
target.Items.Add(temp);
}
}
这篇关于将项目从listview复制到另一个ASP.NET中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文