.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

listView Sort for a celltmplate column

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :WPF
hi , i have a list view with a column that is binded to a field in my database the field contains integers that represents the City_ID , and i a have another table that contains the cities and their ID's, so , when i apply the sort based on this column (City Column) the list View is sorted based on the integers not on the city names here is my XAML definition of that column : GridViewColumn Header="City_Name_ID" Width="75">                         <GridViewColumn.CellTemplate>                             <DataTemplate>                                 <ComboBox IsSynchronizedWithCurrentItem="False" ItemsSource="{Binding Source={StaticResource CitysViewSource}}" SelectedValue="{Binding Path=City_Name_ID}" SelectedValuePath="City_ID" DisplayMemberPath="City_Name"/>                      &nb

View Complete Post

More Related Resource Links

What is the meaning of Ascending\descending sort order of a column within an index

When I add a new index I can also specify the "sort order" as ascending or descending. What does it mean? does it affect performance? does it mean that the binary search tree will be set in a certain way?

3 Column Listview output - is it possible

hi all, i am looking to create a 3 column listview output that looks like this.  Basically its an alphabetic list of one field but it needs to output like newspaper columns.  Is it possible to do this with simply css?  Or will i have to programmaticaly break up the dataset into 3 and actually make 3 listviews?     aaaaaaabaaacaaadaaaeaaaf   aaagaaahaaaiaaajaaalaaam aaanaaaoaaapaaaqaaar

ListView fixed size column headers

Hi, I am using a ListView in its 'Detail' view. I have added several columns there and I want to restrict resizing the column width. I couldn't find a ways to do that; is there any easy way to do that? ThanksCJ

Sort a WPF DataGrid on a Customized Column

I have several wpf DataGrids that use something similar to: {     Binding Path=ContactID, Converter={StaticResource contactIDToNameConverter}}"       As a best concept for various ID fields in my database.  This is great when needing to display editable data that is linked by ID, and my converter handles the validation and cleanup if needed. Otherwise an SQL View, or Joined Table SQL would not be able to send updates directly to the database (DataSet Wizard).  For this DataGrid's Contact column (bound to the ContactID field from a ICollectionView; bound to a DataSet.ClientsToContacts DataTable), I have an underlying value of Integer, and a converted surface value of String.  I want to sort on the string. Using ICollectionView.View.SortDescription(path,direction) will only sort on the Integer, and I am desprately seeking work arounds.  Please help. jvj

Listview column issue??

Hello.      i have a listview with around 9 column and in that i have column as Address.Now everything works fine....Now suppose lots of character in Address then my css breaks...Is it possible to display few characters of the address followed by .....  ??? i have seen in few site but no clue how to implement...like instead of          Abhishek,House No.30,Middle Lane,Arizon.i want just        Abhishek,House No.30,Middle ......and i would like to implemet mouse hover extender later to display full address but i am not able to implement first part only...Can any one guide me on this??? and i have used this link for my css. http://mattberseth.com/blog/2008/05/modifying_data_with_the_listvi.htmlThanks.

How to sort # column in GridView (asp.net) ?


I have a GridView with a column that contains rows numbers. somethign like below :

1    |
2    |
3    |
.     |
.     |
.     |
11  |
12  |
13  |
.    |
.    |
.    |

I've added it to the GridView with the following code :

<asp:TemplateField HeaderText="#" SortExpression="#">
<%# Container.DataItemIndex + 1 %>

Now I wanna sort GridView with this column, I've done it by reading this thread. But when I sort the GridView by # column, it sorts the GridView like below :

1   |
11 |
12 |
.   |
.   |
.   |
21 |
22 |
23 |
.   |
.   |
.   |

How can I fix it

Remove column from Listview


I'm binding a listview control to LinqDataSource and can't find a way to remove unnecessary columns.

Third Party Filtered Lookup is showing RENDER FAILED on clicking to sort Lookup Filter Column.



i know this isn't a Microsoft Plug-in, but I have downloaded and installed the following third party control for WSS 3.0 (Not MOSS). 


Has anyone had this problem. For some reason when I try and sort on a "Filtered Lookup" field I get RENDER FAILED. The column is in my Document Library that has 2,462 documents.

I need to switch off sort on it if possible. I have tried doing with JQuery (using Web Content Web Part), but no luck. 

Can anyone help as this is so important - even if someone can tell me where to start looking in the database. Could it be an incorrect/corrupt link in database or XML Schema File?

Your help would be really appreciated in this hour of need.



Matrix column Interactive sort




In one of my reports, there is a requirement to provide interactive sort functionality on all the columns of the matrix report.

(Reporting Services 2005).


I was successful in implementing the interactive sort on the row groupings, but was unable to do the same on the column groupings.


For example , I have the following :

dropdownlist to sort (ASC/DESC) in Listview



Someone who can help me make a sort (asc / desc) in my ListView through a dropdownlist ?


WPF: how to make a GridView only sort on one column as ascending order?


We use GridView inside the Listview. We need the grid view alwasy sort on one column ascending order and not allow to click column header to change it.

Is there a easy way to achieve it in Xaml?

If not possible, how to achieve it in code behind?



How to sort a TEXT Date Column ?


I have data :- 31-May-07

Its in a calculated column of the list. The method I used to get it :- =IF(FDate="","",TEXT(FDate,"dd-mmm-yy")) {FDate is a DateTime type of column. The returned value is stored in a "Single Line of Text" column type.}

I am now unable to sort that column as its Text now and sorting is done on basis of strings.

I need to sort this column on basis of Date.

Any help ?


Ellipsis and Black color on ListView column




I have a very awesome ListView. Now I want to make it look as awesome as it is. But I don't know how to do it. I have tried to do it with Styles and Templates but I just can't get the hang of it.


Here's what I have:

I have a ListView with a number of columns. Each column corresponds to a Property of MyClass. I have a number of instances of MyClass tossed inside a CollectionView which is set as the source of this awesome ListView. The columns are created during runtime in C# code. So the bindings are done there. There are no column in the XAML part (it's just an empty listview there).


What I want to do:

I want to first of all add CharacterEllipsis on all columns. So that if a columns is too narrow the text inside it will go "Somet..." instead of just cutting it off to Somet (with half a t).


The next thing is that when a column is sorted I want to change color on that specific column, to black. I have managed to use a DataTemplate to style a specific column but the problem here is that I don't know how to do the binding. :(


A small note: each column is created during runtime in C# code (note: not in xaml). I have a loop which creates each column, binds it to the correct corresponding property, and adds it to the ListView.


How to expand the listview column header automatically when text grows?


I have a column goes like this:

 <ListView Name="Col1" Margin="5,0" 
     ItemsSource="{Binding Col1}" 
     SelectedValue="{Binding Col1Item, Mode=TwoWay}"
     Width="100" HorizontalAlignment="Left">
        <GridViewColumn Header="{Binding Col1Header}" DisplayMemberBinding="{Binding Name}" />

data of all the items are bound from viewmodel.cs during runtime. i got a problem where the width of header is not adjusted automatically when i got a longer text for it.

what have i missed? please help.


1 + 1 = 3

using a stored procedure for a listview, I am trying to only return items in a column of a table tha


I am trying to create a stored procedure that when fed a session parameter, it will only find items that  start with a particular character.  For example, if I have a table named table1, and a column name col1, then if I have 10 items in the column and 5 of them start with the letter c, I want to use a stored procedure to onlly return the items that start with a c.

I am sure it is somethin like:


FROM table1 

WHERE col1 = "c??????????"

how to sort a column varchar(50) that contains number


somebody please tell me how to write Sql querry to sort a column of type varchar (50) that contains number







instead of






how do i sort varchar column with number


i have a column in my table  of type varchar (50)







i want to sort in my sql querry like this







please help

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