ok, I'll try to explain a simple logic here, which you can implement. First off, you can create a datagrid and bind a column within it, say with the name "ItemName", e.g.
<asp:BoundColumn DataField="ItemName" HeaderText="Item"></asp:BoundColumn>
Now, within the server side code, you can create a datatable, create a column with the name "ItemName", now simply check for the no of items selected in the listbox, & according to that, follow the steps below:
1. Create new rows in the datatable.
2. Assign the selected value of listbox in the datarow.
3. Bind the datagrid with the datatable.
4. Update a viewstate with this datatable.
(Let me explain the purpose of viewstate. Each time a new item is selected from the listbox, we will first check if viewstate exists, if not create a new datatable, else append the datatable with the existing viewstate.)
5. Finally remove the selected items from listbox.
Any issues, let me know.
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|