listview

C# dropdownmenuitem clicked and listview editing

I have 2 questions concerning C#. 1) I have a dropdown menu with several items in them. They are clickable, but when I click one, the older clicked one stays selected. Click another and the 2 original ones stay selected, and so on. I don't want this. What I want is that when I click one of the dropdownitems, that one is that selected on...

ListView edit command button won't respond

I've got a LinkButton set up in the ItemTemplate of a ListView. It displays fine, but it's not doing anything when clicked. It's supposed to be a simple Edit button, but it's driving my crazy. Here's the button: <asp:LinkButton ID="EditLinkButton" runat="server" CommandName="Edit" Text="Edit" /> and here's the code-behind: Protected ...

Winforms: How can I programmatically display the last item in a C# listview when there are vertical scrollbars?

How can I programmatically display the last item in a C# listview when there are vertical scrollbars? I've studied every method associated with listviews and can't find anything. ...

C# string manipulation - How to remove the first element of each concatenated string in a collection

I am creating concatenated strings based on the data in each row of my ListView control. I need to figure out how to remove the first element in each string which pertains to a single row of the ListView. How might I accomplish this? This is a C# winforms project. Here is my current code: foreach (ListViewItem HazPackE...

Setting maximum number of Columns for ListView

How do we fix the maximum number of columns for a particular ListView control? Is there any thing like this: listViewControl.MaximumColumns = 3; ...

What method or event should I use prepopulate an extended ListView?

I've written an extended ListView in C# WinForms. It's purpose is to show a list of currently running applications using the WinAPI. However, If I try to populate the ListView in the constructor it works when I run the application, but if you try to put the control on any form it will crash VS 2008. The reason for the crashing is I beli...

Variable height rows in WinForms ListView

Is it possible to have variable-height rows within a WinForms ListView in Details mode? There is no RowHeight or Rows[i].Height property on the control as far as I know. Some blogs suggests implementing OwnerDraw, which I did, but I still can't find anything resembling height property from within the event handlers. Ideally, the row ...

WinForms ListView, Remembering Scrolled Location on Reload

I've got a list view that I'm populating with 8 columns of user data. The user has the option to enable auto refreshing, which causes the ListView to be cleared and repopulated with the latest data from the database. The problem is that when the items are cleared and repopulated, the visible area jumps back to the top of the list. So if...

WPF Text Formatting in ListView

I need to apply some text formatting when displaying items in a WPF ListView. The text formatting is nothing too fancy just setting the background colour differently on certain strings within the text. The text does not lend itself to different columns so it's not an option to apply a style to one of the ListView columns. I'm pretty ...

How can I hide the header of a listview WPF?

I want to be able to hide the header at the top of each grid column in a WPF ListView. This is the XAML for my ListView: <Window x:Class="ListViewTest.Test0.ListViewTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Empty ListView Grid" Heigh...

Resizing font in WPF list or grid to use space properly

I have an application that displays league tables for sporting leagues. These tables are basically grids with different columns representing statistics for each team such as matches played, won, lost, goals scored and concieved etc. As such, a league table has one interesting property: For a given competition, we always have the same amo...

Change a selected item in a listview based on the selection in another listview

I have two list views. In the Item command event of the first Listview i am showing the second list view in modal popup using ajaxtoolkit. protected void lvSelection_ItemCommand(object sender, ListViewCommandEventArgs e) { this.lvPopup.Visible = true; this.lvPopup.DataSource = linqdataSource; this.lvPopup.DataBind(); th...

WPF: SelectedItems with duplicate object references

So lets say I have these classes: public class Person { public string Name { get; set; } } public class PersonCollection : ObservableCollection<Person> { } And lets say I have a ListView whose ItemsSource is bound to a PersonCollection. Now lets say I have this code: public void AddPeople() { Person p = new Person() { Name ...

Is there a way to get the number of sub items in a listview?

I am writing a C# application that needs to extract data from a ListView control that resides in an external process. I already have the code to extract data and get the number of items in a ListView but I need the equivalent of the following for sub items: public int GetListViewRowCount() { if (list_view_handle != null...

c# Drag & drop in listview

I've got a listbox from which I'm dragging into the ListView. Now I have groups in the ListView so when the item from the ListView is dropped at the point of the listviewgroup it has to add it under that group. This is the code which handles the drop. private void lstvPositions_DragDrop(object sender, DragEventArgs e) { ...

Erroneous Data Retrieved From ListView

I am having some trouble with my program logic that loops through a collection of data that exists in two separate ListViews. After looping though and extracting the data from the ListView, I then add everything into a comma delimited text file (CLOSEULDCONFIG.TXT). The first time that I execute this logic, everything works as it shoul...

adding items to listview at runtime

Hi guys. When I add new values to a listview using : Set lstView = ListView(0).ListItems.Add(, , txtName) lstView.ListSubItems.Add , , txtValue lstView.Refresh The only problem is that this only displays a blank new line in the listview, any idea how to update it correctly? Normally I am using a recordset so simply clear...

CustomAction not appearing in ListView web part for SPList that does not inherit permissions

I have a SharePoint document library created and it is set to not inherit permissions from the web. I've configured a ListView webpart to display the contents of the document library and it works fine. I created a user that has the Contribute permission to the document library, but can only read the rest of the site. I created a custo...

ListView_SetBkImage does not work on XP

I want to set the background image of a ListView control in my Shell Extension. The ListView inherits IShellView and I am using the following code:- HBITMAP m_hBmp = (HBITMAP)::LoadImage( hinst, MAKEINTRESOURCE( IDB_BITMAP1 ), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS); if ( m_hBmp ) { LVBKIMAGE bki; ...

Displaying information with fields and values: ListView, GridView, FormView???

I just want to show some data for a user (name, email, address, identifier, entry date) on an asp.net page. Which ASP.NET control would be the most suited for this? ...