Click here to Skip to main content
15,898,222 members
Everything / ListView

ListView

ListView

Great Reads

by ThatsAlok
Using Fragments in your mobile application.
by #realJSOP
A WPF ListView that automatically generates columns (that are also sortable) based on decorated entity properties
by John Atten
Examination of a quick way to create more useful expandable groups in the .NET ListView control.
by Technoses
The above code will slow down the browser and the browser can hang when Rows in Grid will be 10000 or above.Please view the below suggestion:CS Codeprotected void grvGroups_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { ...

Latest Articles

by Jovibor
List Control with tooltips, cells editing, colors, sorting, hyperlinks, columns hiding, and a lot more
by #realJSOP
A WPF ListView that automatically generates columns (that are also sortable) based on decorated entity properties
by Thiagarajan Rajendran
How to create a checkbox list using simple HTML and jQuery
by Michael Shpilt
A WPF tutorial on how to create FilteredListView: A ListView custom control with search filter that uses Throttling.

All Articles

Sort by Updated

ListView 

15 May 2010 by #realJSOP
I googled "c# winform listview drag and drop" and got 42000 hits. Maybe your answer is in there (and will probably include source code).
1 Jul 2014 by #realJSOP
I've bound the control's ItemsSource property to an ObservableCollection of items (deriving from INotifyPropertyChanged), but when I add items to the collection, the ListView doesn't update in the form.If I put a breakpoint in the code after the line that adds the new items, the...
1 Jul 2014 by #realJSOP
Nevermind - the problem was that I was instatiating a new instance of the ViewModel before retrieving the data.
15 Jan 2017 by #realJSOP
Did you inspect the SelectedItems collection to make sure it's not empy?
10 Apr 2018 by #realJSOP
You could try this (no guarantees): stView1.SelectedIndexChanged-=listView1_SelectedIndexChanged; listView1.SuspendLayout(); try { // selection loop } finally { listView1.SelectedIndexChanged+=new EventHandler(listView1_SelectedIndexChanged); listView1.ResumeLayout(); }
7 Oct 2019 by #realJSOP
Your need to add a ToString() override to your list items. This overridden method should include a call to either string.Format, or use the StringBuilder class to construct your result in a formatted way.
20 Dec 2021 by #realJSOP
0) Instead of having a ListView that has one column, wouldn't it make a lot more sense to use a ComboBox? 1) If you use binding, you don't have to manipulate the control itself when items are added.
18 Feb 2021 by #realJSOP
A WPF ListView that automatically generates columns (that are also sortable) based on decorated entity properties
29 May 2010 by #realJSOP
One technique for having a column width that grows/shrinks with ListView width
23 Apr 2017 by .dot IT Solutions
I have a ListView named lvSelectCustomer. I loaded some values in lvSelectCustomer. The lvSelectCustomer has 5 columns. Column[2] and Column[4] are hidden by set its Width into zero. Because i don't want to show those colums while runtime. All data are loaded successfully. No problem in loading...
5 Sep 2017 by .dot IT Solutions
I am a newbie in C#. Please HELP me. Scenario: I have a Form, named as frmModifyService. This Form will show service details which proceed earlier. In this Form there is a ListView, if I will select a Service ID from a ComboBox all the used componets of that service will load into the...
26 Nov 2014 by /\jmot
Another way..foreach (ListViewItem item in listView1.Items){ String abc = Convert.ToString(item.SubItems[1].Text);//etc etc }
26 Apr 2013 by _Amy
You could have tried Google[^] for the solution.Refer the links below:Show Image in Listview retrieve from database in ASP.net[^]How To Retrieve Image from Database in ListView Control in asp.net 3.5 [^]How to Retrieve Images from Database into Listview using Eval()[^]--Amit
4 Jun 2013 by _Amy
This exception is obvious. You are trying to access a member of an collection which does not exist. For e.g. your ListView is not having any item or it is null but still if you are trying to access the ListItem. This will throw an error. Try stepping through your code and check the value of...
9 Apr 2014 by A College boy
i have created an listview based app in which when i add data through another activity the data doesnt get updated in the listview where as it should get updated in the listview !!when i have created an onSave method on the save button in the activity but it doesnt seem to get updated in the...
5 Dec 2013 by abbaspirmoradi
For the datatable you can get the number of rows using:dt.rows.countAnd in the populated listview you could useListView.Items.CountRef to this:http://www.dreamincode.net/forums/topic/269486-counting-the-rows-of-listview/[^]
30 Jun 2014 by Abdallah Al-Dalleh
Hello AllI have the following ListView
15 Sep 2020 by abdou_31
I'm trying to bind data inside a listview that contains textblock , the problem is that I can only show the first element of the model ( the first row of the listview ) , I would like to bind all data in the listview. What I have tried: ...
15 Sep 2020 by abdou_31
Thanks to all, I have changed to listView with GridView and it work for now
20 Nov 2013 by Abdul Gafar
Hi,I need help in implementing this below:I have a list view containing students courseworks, one column holding the barcode IDs, one column holding subject code, one holding the coursework title and one holding the due dates.I want to have a button click event where by it checks the...
15 Apr 2014 by Abdullah AL Samman
Use String out= Environment.getExternalStorageDirectory().getAbsolutePath() + "/X/Y/Z/" ; File outFile = new File(out, Filename);After Editing in your ref. Link Answer. private void copyAssets() { AssetManager assetManager = getAssets(); String[] files =...
28 Jul 2014 by Abhijit Ghosh (Subho)
Go through ListView Control[^]
8 Sep 2016 by Abhimaan Sharma
Hi, I am developing a web-portal for a client his requirement is to be build this site in dotnet. Can anyone suggest me how can I show product + product name + price + description in detail page.Datalist, Listview or Repeater which one is better for ecommerce website in dotnet.What I...
23 Jan 2011 by Abhinav S
This[^] article might help.
1 Sep 2011 by Abhinav S
This[^] talks about an interesting workaround that uses AddRange to make the Listview faster.
18 Dec 2011 by Abhinav S
This[^] might help you out.
5 Feb 2013 by Abhinav S
If you have the multiselect[^] property turned on, the ListView has a SelectedItems[^] collection that can be used to return all the rows that have been selected in the listview.
5 Jan 2014 by Abhinav S
You can easily search the number within the listbox.Have a look at this[^] example.
25 Nov 2014 by Abhinav S
foreach (var item in listView.Items){ //Do stuff}
3 Mar 2013 by Abhishek Pant
Making your own 3D list – Part 2[^]
11 Jul 2011 by Abu_ Ehab
How Can Create ListView In VB.Net and Make Connection With ADO.Net ?
7 Mar 2011 by aburrow
I found this code and have been attempting to Bind it to a listview control with no success (The idea is to display the members of a group defined in a gridview in another Panel). If I setup an ObjectDatasource and use a DefaultValue it displays the members of that group (although the formating...
12 Mar 2014 by AC_Redz
Hi tq,,i just want to help..try this: listView1.Bounds = new Rectangle(new Point(10, 10), new Size(300, 200)); listView1.View = View.Details; // Allow the user to edit item text. listView1.LabelEdit = true; // Allow...
12 Mar 2014 by AC_Redz
Here's the content of the class:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace WindowsFormsApplication1{ class Class1 { private string item1; private string item2; private string item3; ...
16 Jan 2012 by adenanzaman
dim listview1 as listviewlistview1.item.removeat(selected.value())adnan zaman
4 Oct 2014 by Aditya Prakash Roy
hello thomas,I think We Can Easily do this by using WPF Application:the complete solution is below:for Start VS2010 then Add a new project named as using a WPF Application:then Add This Code in MainWindow.xmal---
28 Jul 2011 by adnama
I have a list view that is being filled with a list. when i put a messagebox to tell me count of the list view it is giving me the correct answer so the listview is being filled, but nothing is displayed.this is the code of the binding.
1 Aug 2011 by adnama
i am trying to remove an item from a listview with the selected index. but it is not accepting it. this is the code up.Remove(usageProfileLists123.SelectedItem.ToString());the thing is that the list is of type usageprofile and it is saying :Error 3 The best overloaded method...
5 Dec 2019 by Aftab Iqbal Clips
Thumbnails are not aligning vertically in listview with bootstrap here is markup What I have tried: ...
11 Aug 2014 by Afzaal Ahmad Zeeshan
This article explains how you can use ASP.NET (C#) and search for related queries in your Database.
2 Oct 2021 by ah2005
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Dim Msg As CWPSTRUCT Select Case uMsg Case WM_NOTIFY Dim y As NMLVDISPINFO Dim item As LVITEM ...
17 Oct 2015 by Ahmed Zoeil
i have sql table 1 that contains itemcode - itemcount - tablenameand my windows form1 contains listview1 and button1what i'm trying to do is that when i click on button1 all listview1 SubItems[1] values in the column to update from tables names in SubItems[2] values where itemcode values...
17 Oct 2015 by Ahmed Zoeil
I have form1 and form 2 .. and listview1 on form1 , listview2 on form2 when listview1 in form1 and listview2 in form2 and both listview contain : itemcode - itemcount . and button1 in form2on form2 if user click button1 values in listview2 on form2 be populated in listview1 on form1 and...
18 May 2012 by aj0000
How can I populate a listview in virtual mode(I have several thousand of ListViewItem to add). I do not know how many items to be added in advance, I must add items asynchronously.I added the method 'RetrieveVirtualItem', which is: 'e.Item = listOfItems[e.ItemIndex];'Another class creates...
9 Mar 2015 by Ajay Kumar
I need a help for listview drag n drop opretion in winforms. where listview1 hold the images(LargeIcon) and when i double click on any images from listview1 it will delete from listview1 and show in listview2 and then when i click any button i want all paths of Images which is in the listview2....
24 Sep 2013 by Ajay Kumar Vishwakrama
protected void btndelete_Click(object sender, EventArgs e){DataTable dt = new DataTable();var rowsToDelete = new List();if (Session["CurrentTable"] != null){dt = (DataTable)Session["CurrentTable"];for (int i = 0; i
5 Feb 2016 by Ajit Hegde
I have 4 subjects. Each subject has 500 questions. Once program loads settings it will give you an option to choose subject. Once user selects a subject it will load the list of questions. If question is solved then it is shown as green. I am trying to scroll to unsolved questions...
6 Feb 2016 by Ajit Hegde
I don't know what the problem was. But I found out that if you call ScrollIntoView from an event it will work.So I created Layout_Updated event. Called the ScrollIntoView from that event.
10 Oct 2012 by ajithk444
h,I have a column [Invoice_No] in my grid. the values are like "Invoice # 120 "I need to save only 120 from this into an integer list.How can i save this using c# in my asp.net application. .pls help me..thanks in advance.
4 Dec 2012 by Akbar Ali Hussain
After enabling VisualStyle it may take sometime to get True for RenderWithVisualStyles property. Try executing another DoEvents() before checking this property.
28 Jan 2012 by akul123
You cannot vote on your own post0I have filled an imagelist using the following code in a button click. everything works fine.DirectoryInfo dir = new DirectoryInfo(@"c:\MyPic");foreach (FileInfo file in...
30 Jan 2012 by akul123
I have loaded some images in a listview using imagelist in c#. Now I want to copy any image and paste into another image within this listview using drag and drop. that is copy first image and paste into second image in the listview. How could I do this? sample code would be helpful.Thanks in...
19 May 2019 by Alan Burkhart
My current project includes an ownerdraw ListView with 6 columns used only in Details View. I rarely use the ListView so I'm likely just missing something obvious. I don't need to sort on each column. Sorting the entire list is sufficient (on col 0). The form loads with the ListView.Sorting...
12 Jan 2017 by Alex Banu
You can make a simple html list with js.Maybe you can use codebehind repeater to get some results.
25 Apr 2013 by ALNAJJARALI
hi all,Is there a away to retrieve images from database in a Listview ??
26 Apr 2013 by ALNAJJARALI
hi all:I wrote this peace of code: name: ...
17 May 2013 by ALNAJJARALI
Welcome all:I would like to ask you about this javascript, this is a peace of code: name:
9 Dec 2016 by Alpha21oct1989
I have prepared a view in which there is a ListView Control whose ItemSource is being populated with the XML data.However along with the XML data I also required to have a check box and 2 textboxes which takes two different values.What I have tried:The view has been achieved with the...
3 Jun 2013 by AlphaDeltaTheta
Multithreading issues... I see, the solution is mentioned in the exception itself. You can only modify the view in the thread you created it. Move this line out of the new thread fmd.Data(ser.FindClients().interact.get(a).fileNames);You need some concurrency utilities to solve this,...
17 Sep 2014 by AlwaysLearningNewStuff
INTRODUCTION AND RELEVANT INFORMATION:I am trying to implement listview control with editable items and subitems. Instead of regular listview look, items and subitems should have edit control, checkbox or combo box.I am using raw WinAPI and C++. I am targeting Windows XP onwards.MY...
17 Feb 2015 by AlwaysLearningNewStuff
INTRODUCTON:I am working on a drag and drop feature of the listview. I am stuck at the last step -> rearranging multiple selected items after user finishes drag and drop.QUESTION:Can you explain me the algorithm that implements item rearrangment ( I wish to implement default drag &...
2 Mar 2015 by AlwaysLearningNewStuff
INTRODUCTION:I am implementing rearranging of listview items without using OLE drag and drop.PROBLEM:I have successfully solved most of this task, except scrolling up/down when user wants to drop items at the position that is not currently visible.QUESTION:I am able to scroll...
9 Mar 2015 by AlwaysLearningNewStuff
I want to determine if user is dragging listview item, by pressing ( and holding ) left mouse button.I am processing WM_MOUSEMOVE[^] and testing if user is dragging with if( wParam & MK_LBUTTON ).Does this condition give me 100% accurate info about user dragging the mouse, or are there...
12 Mar 2015 by AlwaysLearningNewStuff
INTRODUCTION:I am trying to determine if user clicked on item or above/below listview.Listview is in report mode, with extended styles full row select and grid lines.PROBLEM:I am not able to get correct results, based on the docs for LVHITTESTINFO.MY EFFORTS TO SOLVE THE...
30 Jan 2012 by ambarishtv
Hi,try this linkDrag and drop, cut/copy and paste files with Windows Explorer[^]copy-paste listview item using drag-drop[^]
9 Jul 2020 by amitb2
I have small app should pass values from 1 activity to custom listview that display in tab. The problem is I have 4 tabs and the values should appears in the 2nd tab but it doesn't, only after I pressed the last tab (4th) and go back to the 2nd...
22 Jun 2012 by AmitKumar89
Hi,You just try this and check whether your grid is firing event or not. protected void ListView_image_ItemCommand(object sender, ListViewCommandEventArgs e){ ScriptManager.RegisterClientScriptBlock(base.Page, this.GetType(), "Myscript", "alert('Event fired..');", true);...
22 Jul 2013 by Andrew797
I need some help, maybe my way of thinking is just not right here.I used twitter bootstrap to design the interface for my web page. I have a Catalogue page, and in this page, I will display 2 rows, each containing three products (Image and some description). I am going to implement...
3 Jan 2017 by Andy Lanng
So via the comments we found that the requirement is to populate the recordset from a given dataset. The method giving the error should never be used for this purpose, so the exact error message is not relevant to the issue.Given this new information I was able to find this page:convert...
18 Jul 2016 by Andy Point
Android Alert Dialog Tutorial : Working with Time Picker, Date Picker and List Dialogs In this tutorial we will discuss how to use dialogs and alerts in Android Apps. A Dialog is a small popup shown to the user to get some additional information from the user or ask him to make some decision. Alert
6 Apr 2011 by Ankur\m/
This is so Google question.I took two most important keywords from your question - "random" and "sql" and Googled the concatenated string.The very first link answers your question. See it yourself - Google search - random sql[^]Wasn't that simple?! :)
25 Nov 2015 by ANSHUL JAIN
Dear All,I have a requirement wherein I have a ListView with 7 columns. By default, column 5,6,7 are not visible and require me to use the Horizontal Scroll BAr to scroll towards right. Is there a way by which my scroll bar can move towards right by default when the ListView is loaded?
24 May 2019 by anthasaurus
19 Jun 2012 by Anubhava Dimri
By Using Ternary Operator or Case or Condition you can display the result according to your condition.
13 Dec 2011 by Anuj Banka
ON ItemDataBound this event will run for each row of the listview.And you can modify the data for each row and can access controls of each row.check this exapmle:If (e.Item.ItemType = ListViewItemType.DataItem) Then Dim divCatHeader =...
15 Jan 2012 by Anuja Pawar Indore
Refer this, might help youhttp://www.dotnetspider.com/resources/38294-How-Fix-Header-Column-GridView.aspx[^]
19 Jun 2014 by anup.bhunia
In windows application you could achieve that handling OwnerDraw or DrawSubItem events. If you change any value of the subitem, it will fire the DrawSubItem event and on that event you could draw the progress.You could refer to following article for more...
16 Jan 2011 by Anupama Roy
This below sample will help you to understand how to get the subitem clicked on ListView.sample[^]For passing from one form to another,you can follow the above steps mentioned.
5 Dec 2023 by Anuragintit
I need to merge the common row in listview, but long time search i am unable to find out the solution, any one can please help. Getting the Error: Unable to cast object of type 'System.Web.UI.WebControls.Label' to type...
9 Sep 2012 by Anusha Sridhar
Hi, I have exported values from datatable to excel using list.. I have inserted values to the list and passed that in a grid and using ExporttoExcel() i have exported it to excel.. here is the code for list... protected void Page_Load(object sender, EventArgs e) { ...
26 Nov 2014 by aravinth santosh
I think you are manually typed this line.String abc = listview.Items[i].Subitem[i].Text;The line should be,String abc = listview.Items[i].SubItems[i].Text;SubItems and not Subitem
13 Oct 2010 by Archit9373284448
hi to all,i have added files and folders in list view and set list view's vies as list,when it displays the files it shows in very wired fashion (no alignment at all)attaching the image and please tell me what should i do to make it right. image
14 Sep 2020 by Arindam Mukherjee
For a couple of days, I am trying to achieve a simple task. I want to filter a listview and when I click on the filtered list item, the OnItemClickListener collect the postID from the desired list item and put that value to next activity. But the problem is, the onItemClickListener is not able...
10 Oct 2012 by arshad alam
Try below code according to your requirement: string[] ArrInvoice = { "Invoice # 120", "Invoice # 121", "Invoice # 122", "Invoice # 123" }; List lstInvice = new List(); foreach (string item in ArrInvoice) { int intInvocie...
10 Oct 2012 by AshishChaudha
Try thisstring txt = "Invoice # 120"; string[] txt1 = txt.Split('#'); Response.Write(txt1[1].Trim());Thanks
18 Oct 2012 by ashokdamani
actually i have a carttable , which is assigned in a session...whenever addtocart button clicked of any product in product_details page thn quantity also sends to cart page through the query string , and gets navigate to the cart_page and fills also the txtbox value for quantity..Also want to...
4 Dec 2019 by Ashutosh Gpt
if remember well from our last discussion in previous question, i have gave you program using MVVM in the same you can improve this case too. OnInsert() will be hot when you click on your button to add ph number. ...
11 Oct 2013 by ASP.NET Community
Check out the Feature Specifications for Visual Studio 2008 and .NET Framework 3.5. These older documents give you an insight into what features made
11 Oct 2013 by ASP.NET Community
Both the GridView and ListView are important Data Controls in Visual Studio 2008.Scott Guthrie has a great introduction that uses the ListView
11 Oct 2013 by ASP.NET Community
Some people think that the ListVew is a better Repeater and is one the best new additions to Visual Studio 2008.Blogs/ArticlesUsing the
11 Oct 2013 by ASP.NET Community
Here is a simple, pictorial example of inserting, updating, deleting and paging records using ListView
11 Oct 2013 by ASP.NET Community
The ListView is a sort of hybrid between a DataGrid and Repeater thatcombines the free form templating of the Repeater with the editingfeatures
11 Oct 2013 by ASP.NET Community
Performing ASP.NET ListView Item Delete Confirmation using jQuery Colorbox.Here I use Google Hosted jQuery Library because it serve jQuery to users
11 Oct 2013 by ASP.NET Community
  The ListView control is a new data presentation control that was added to .Net 3.5 , you may wonder why its added to the framework , and what it
27 Aug 2013 by athira Paramesh
hai, i want to bind listview using json,bind data in clientside ...
28 Jul 2013 by atunahkur
Hi,I've got one form(contains listView1) and class class1.listView1 is like a log. The actions in class1 must be shown in listView1.form: public void uuendalogi(ListViewItem logi) { listView1.Items.Add(logi); }class1: string[] str = {...
30 Oct 2021 by Avtem
What i need Does LVS_EX_LABELTIP for Win32 ListView automatically implement showing tooltips for truncated items (i.g."Hello, W...")? Like style LVS_EX_CHECKBOXES which works "out of the box". Or is it developers responsibility? (From reading...
9 Jul 2023 by Avtem
There is a WM_SETREDRAW message in WinAPI which you can send to a window in order to suspend/resume drawing updates. It works fine, but as soon as i add visual styles from comctl32 v.6.0.0 to my program calling WM_SETREDRAW on a ListView control...
9 Jul 2023 by Avtem
Unfortunately i couldn't figure out how to use WM_SETREDRAW with ListView controls, but since MDSN describes us how it's implemented i decided to do what they do - remove or add WS_VISIBLE style from the window without invalidating its rectangle....
17 Sep 2011 by awaisdar
on Edit Linkbutton it fires the command but cant write " this.ModalPopupExtenderQ.show();" because its un accessible here.I want to edit the contents of "actual panel" in Modalpopup how can i assign the values of the labels of actual panel to the textboxes of Popup Panel???Please...