伙计们我在这里疯了。请问我有一个listview,我想动态地从文本框中添加一个项目到按钮单击列表中。我想删除按钮点击以及。我的问题是我目前不能在增加一个项目,以列表视图,因为我gtetting error.I想我的列表视图有两列,因此在数组中插入数据的两个字符串如下Listview动态地添加和删除不工作的项目
string[] array = { DropDownListType.SelectedItem.Text, txtDescription.Text };
List<string> list = new List<string>();
list.Add(array[0]);
foreach(string[] value in list)
{
ListViewItem lvi = new ListViewItem(value);
ListViewDesc.Items.Add(lvi);
}
以前,我没有列表添加我的字符串,但都失败了。我真的很困惑。此外,属性“Listview.Column.Add
”给出未知属性错误。请任何替代方式,我可以实现这一点将不胜感激。我有我的列表视图下面。
<asp:ListView ID="ListViewDesc" runat="server">
</asp:ListView>
http://stackoverflow.com/questions/11423537/how-to-add-subitems-to-a-listview –