Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HIIII,ihave a requirement such that,am deleting the checked items in a list.after deleting , when i came back to the original list ,finding deleted items in the list.when am deleting they are deleting they are not updating in original list plssssssss help me...........................
thanks in advanceeeeeeeeee
Posted
Comments
Mehdi Gholam 4-Nov-11 2:48am    
Have you tried refreshing the original list?

place drop down list in ajax updatepanel.
 
Share this answer
 
foreach(int i in index)
Mylist.removeat(i);
it will be good if you post your code what are you trying to do
 
Share this answer
 
Ok so it is a little hard to understand exactly what you want to do but if I understand correctly you have a ListView and a List<T> (probably a List<string>)??

Well if so you probably want to do something like this:

C#
List<string> myList = new List<string>();// your list somewhere else in your code
myList.Add(listView1.Items[0].Text);
myList.Add(listView1.Items[1].Text);
//

ListViewItem[] removable = new ListViewItem[listView1.SelectedItems.Count];
listView1.SelectedItems.CopyTo(removable, 0);
int[] selectedIndices = new int[listView1.SelectedIndices.Count];
listView1.SelectedIndices.CopyTo(selectedIndices, 0);
string[] selected = new string[selectedIndices.Length];

for (int i = 0; i < removable.Length; i++)
{
    listView1.Items.Remove(removable[i]);
    selected[i] = myList[selectedIndices[i]];
}

for (int i = 0; i < selected.Length; i++)
{
    myList.Remove(selected[i]);
}


would also work if List<T> was something else say List<ListViewItem>

Note: There is probably more elegant solutions to this (I know I have come up with some myself before) but right not I can not think of any. This will hopefully at least get you started.

If this is not what you are trying to do at all maybe you could explain a little more about what it is exactly you are trying to do.
 
Share this answer
 
v8
Comments
LanFanNinja 4-Nov-11 22:39pm    
I had to edit this 5 times because CodeProject does not like text inside angle brackets so as a last resort I had to go back in and replace angle brackets with html !?!?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900