Click here to Skip to main content
14,922,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
but not for specific column
for every item c# .Net
Posted

Have you checked the ListView.SelectedIndices[^] property of list view

sample:
C#
ListView.SelectedIndexCollection indexes = this.ListView1.SelectedIndices;
 double price = 0.0;
 foreach ( int index in indexes )
 {
    price += Double.Parse( this.ListView1.Items[index].SubItems[1].Text);
 }
   
Comments
radals 6-Feb-13 3:15am
   
no i cant
but i try it solution & get specific item
ListViewItem item = ListView1.Items[4];
Label country = (Label)item.FindControl("idLabel");
SqlComm.Parameters.AddWithValue("@ProductId", country.Text.ToString());

FileUpload f2 = (FileUpload)ListView1.EditItem.FindControl("MyFileUpload");
string filename2 = Path.GetFileName(f2.FileName);
SqlComm.Parameters.AddWithValue("@Product_thumb", filename2);

//the problem here how i can have more values Row of label of listview based on ids come from lable
Jibesh 6-Feb-13 3:18am
   
wait was this a web UI ?
Dear, you can try this code,
It will surely help you.

myListView.SelectedItems(0).Index

Or

myListView.SelectedIndices(0)
   
Comments
radals 6-Feb-13 3:10am
   
yes i try it before but in C# i dont found this proberity
ListView1.SelectedItems(0).Index

Or
ListView1.SelectedIndices(0)

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