This is a migrated thread and some comments may be shown as answers.

[Solved] Column Sorting Removed

1 Answer 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 06 Aug 2009, 07:11 PM
Hi,

I'm having a problem with my column sorting being reset when I first bind the GridView to a data source. I am setting the sort for a column in XAML and the ItemsSource is being set programmatically. The data source is an Entity collection generated from RIA Services. The objects being passed from the server side are POCO objects created by me. Does an Entity collection retain some kind of information about sorting? So when the GridView is bound and the data comes back, the collection has no sorting associated with it? I would provide a sample but it would be difficult with my current code. I will make one if needed though.

Thanks,
Chris

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Aug 2009, 06:56 AM
Hello Chris,

I've just tried this using DomainDataSource however the grid SortDescriptor declared in XAML worked fine. Here is an example:

<UserControl x:Class="SilverlightApplication2.Page" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:riaData="clr-namespace:System.Windows.Data;assembly=System.Windows.Ria.Controls" 
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls" 
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data" 
    xmlns:web="clr-namespace:SilverlightApplication2.Web"
    <Grid x:Name="LayoutRoot" Background="White"
        <Grid.RowDefinitions> 
            <RowDefinition /> 
            <RowDefinition Height="30" /> 
        </Grid.RowDefinitions> 
        <riaControls:DomainDataSource x:Name="DomainDataSource1" AutoLoad="True" QueryName="GetTable1"
            <riaControls:DomainDataSource.DomainContext> 
                <web:DomainService1 /> 
            </riaControls:DomainDataSource.DomainContext> 
        </riaControls:DomainDataSource> 
        <telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding Data, ElementName=DomainDataSource1}"
            <telerik:RadGridView.SortDescriptors> 
                <telerikData:SortDescriptor Member="Name" SortDirection="Descending" /> 
            </telerik:RadGridView.SortDescriptors> 
        </telerik:RadGridView> 
        <data:DataPager x:Name="DataPager1" Grid.Row="1" PageSize="10" Source="{Binding Data, ElementName=DomainDataSource1}" /> 
    </Grid> 
</UserControl> 
 

If you can send us small example demonstrating your scenario we will gladly help you.

You can find small application attached.

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or