動的グリッドビューを作成し、そのグリッドビュー内で、そのグリッドビューをリストボックスアイテムにバインドしたいと思います。グリッドビューの最初の2列をチェックボックスとして、3番目の項目をリストボックスの項目として使用します。こんなもの欲しい
foreach (ListItem item in Listbox1.Items)
{
if (item.Selected)
{
Listbox2.Items.Add(new ListItem(item.Text, item.Value));
}
}
GridView gridview1 = new GridView();
foreach(ListItem item in Listbox2.Items)
{
CheckBoxField chk = new CheckBoxField();
chk.HeaderText = "Test1";
gridview1.Columns.Add(chk);
CheckBoxField chk2 = new CheckBoxField();
chk.HeaderText = "Test2";
gridview1.Columns.Add(chk);
// another columns that displays the item from the list box
// another column that displays the value of the item of the listbox, but the column is hidden.
}
どうすればこれを達成できますか?