K
KB
language: c#
ok this has been driving me crazy for too long now!!!
on my page i have 2 listboxes along with an add button and a remove button
the idea is i can add items from listbox1 into listbox2 and i can remove
items from listbox2 only
listbox1 is populated from my database which contains a list of cars
on clicking the add button, the value from the selected item in listbox1 is
inserted into a new table, which in turn populates listbox2, which all works
fine
but when you click the add button i want the selected item from listbox1 to
be removed from listbox1, but i need this to be the case when the user
leaves the page & then comes page
so what iam thinking is:
when the page loads,
- loop through listbox2
- get item in listbox2
- look at listbox1 and remove the matching item
--------------------------------------------------------------------------------------------------
CODE:
//if !Page.IsPostBack
for(int i=0; i<listbox2.Items.Count; i++)
{
string vSel = listbox2.Items.Text;
listbox1.Items.Remove(listbox1.Items.FindByText(vSel).ToString());
}
just starting c#, any help much appriciated
ok this has been driving me crazy for too long now!!!
on my page i have 2 listboxes along with an add button and a remove button
the idea is i can add items from listbox1 into listbox2 and i can remove
items from listbox2 only
listbox1 is populated from my database which contains a list of cars
on clicking the add button, the value from the selected item in listbox1 is
inserted into a new table, which in turn populates listbox2, which all works
fine
but when you click the add button i want the selected item from listbox1 to
be removed from listbox1, but i need this to be the case when the user
leaves the page & then comes page
so what iam thinking is:
when the page loads,
- loop through listbox2
- get item in listbox2
- look at listbox1 and remove the matching item
--------------------------------------------------------------------------------------------------
CODE:
//if !Page.IsPostBack
for(int i=0; i<listbox2.Items.Count; i++)
{
string vSel = listbox2.Items.Text;
listbox1.Items.Remove(listbox1.Items.FindByText(vSel).ToString());
}
just starting c#, any help much appriciated