.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Sorting ListView in Virtual Mode

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :Windows Application
Hi,   Can ListView contol be sorted when in Virtual Mode?   Please assist   Thanks

View Complete Post

More Related Resource Links

listview crashes under virtual mode




 I have wrote a very simple application. In the application, I added a listview control and set to virtual mode. Then I added a thread to append items into the listview. And I added a sort function for the listview. I found the application will crash when appending data after I sort the listview.

The code of thread is below:

private void ThreadWork()
  int i = 0;  
  while (!_shouldStop){

  BeginInvoke(new Action<int>(NotifyUI), i);

private void NotifyUI(int arg)
  int i = arg;  

  ListViewItem item1 = new ListViewItem("item" + i / 100, 0);
  item1.Checked = true;
  item1.SubItems.Add(i.ToString() + "," + 1);
  item1.SubItems.Add(i.ToString() + "," + 2);
  this.listView1.VirtualListSize = this._listItems.Count;
  this.listView1.EnsureVisible(this._listItems.Count - 1);    


The sort function of listview is very simple. I just sort this._listItems. I added the code in the handler of button click.

What's wrong with

Data template for Icon in Header of listview on sorting

I have 2 datatemplates that show 2 icons for sorting on ascending and on descending.. <DataTemplate x:Uid="HeaderTemplateArrowDown"> <DockPanel> <TextBlock Text="{Binding}"/> <Path x:Name="arrow" StrokeThickness = "1" Fill = "gray" Data = "M 5,10 L 15,10 L 10,5 L 5,10"/> </DockPanel> </DataTemplate> <DataTemplate x:Uid="HeaderTemplateArrowUp"> <DockPanel> <TextBlock Text="{Binding }"/> <Path x:Name="arrow" StrokeThickness = "1" Fill = "gray" Data = "M 5,5 L 10,10 L 15,5 L 5,5"/> </DockPanel> </DataTemplate> So now how do i use these in my theme file . How do i use them at a time all over my project in multiple forms from my theme file. Like how do i include these datatemplates into the GridViewColumnHeader Style.

Listview edit mode


How do I change to edit mode programmatically using vb code?  My edit button is not switching the record to edit mode and I get the error:  The ListView 'ListView1' raised event ItemEditing which wasn't handled..  I am using a similar edit button on several FormViews and they work fine.  I cannot figure out why it is not working on the ListView.  I have searched the Net for a couple days without success for ideas on how to access using VB coding.  Does anyone have any ideas?  Thanks.  

<asp:ListView ID="ListView1" runat="server" >



AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

Sorting Gridview using Jquery with ASP.NET

I want to show how to sorting a gridview using a Jquery in ASP.NET, it is a flexible client-side table sorting. We have known that Jquery is a new kind of Javascript Library. You can find detail of Jquery in this site http://jquery.com/ there are lot of example with documentation and also allow free download a latest version.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Sorting Gridview using Jquery with ASP.NET

used table sorter plug-in which has written by Christian Bach can found http://tablesorter.com/docs/ . It is really cool plug-in and user can allow to download and customization as their wish.

I test this example in Visual Studio 2005. Some of other requirement needed is download a latest version of Jquery from official website and table sorter plug-in which can found as I mention above website.

GridView Sorting/Paging : 'REAL' AJAX with Asp.Net Series

This is a continuation of my 'REAL' AJAX with Asp.Net (not Asp.Net AJAX) series posts for those of us trying to stop relying on Asp.Net 'AJAX'.

Ok, nothing too dramatic to start things off, we are going to make some tabled data sortable and pagable all without using a bit of postback. Not only that, but it is going to be incredibly easy!

Sorting Data in a GridView Web Server Control

The GridView control provides built-in sorting functionality without requiring any coding. You can further customize the sort functionality of the GridView control by using custom SortExpression property values for columns as well as by using the Sorting and Sorted events

Sorting GridView Columns Manually

We all know that GridView columns can be sorted automatically when SQLDataSource is being used. But what if you are not using SqlDataSource to populate the GridView. Sorting the GridView manually is pretty straight forward task take a look at the code below

Manually sorting and paging Gridview without using datasource control

Many a times while working with Gridview we want to work with the paging and sorting functionality without using any datasource control. Gridview is flexible enough to perform these tasks without the use of any datasource control and only a few lines of code.

Optimized Paging and Sorting in ASP.NET GridView

In this article I am going to demonstrate what are the performance drawbacks of using conventional way to page and sort your GridView and then I will demonstrate 'An Optimized way to implement Paging and Sorting'.

WPF Tutorial - Using The ListView, Part 1

Many of the controls in WPF have a downright dizzying array of capabilities and features, due in large part to the composibility of all the components. The ListView control is a great example of this - the possibilities are almost endless. This series of tutorials on the ListView will hopefully make the space of possible options seem not quite as daunting

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Difference Btw Website vs Web application and Virtual directory in IIS 7


May i know what is the Differenc that they actually make in IIS7 .

Please tell me at a low level as i am still a novice in Asp.Net


Thanks in Advance.


How to listen to events within a listview



I've got a listview and I've put a button control in one of the columns, I'm trying to figure out how I have listen to the button click within a certain row, but can't see the button in the dropdown for the IDs I can generate events for.

I'd like to get the primary key of the row that's been clicked on and then run a sql statement against it.

Any help would be appreciated.

ListView DataPager with SQL-Statements that already return only paged data.



As far as I understand the ListView-Control and the DataPager-Control, they work like this: The ListView gets its datarows from its data source, then the DataPager causes the ListView to display only a subset of those rows.

So what, when I want to use custom databinding for the ListView, that *already* gets the certain subset from SQL-Server (for better performance). Can I and how can I use the DataPager then?

Thanx, S.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend