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

Simple Sorting not working properly

2 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michaël Kiekens
Top achievements
Rank 1
Michaël Kiekens asked on 24 Jun 2010, 02:47 PM
I have a simple grid where I allow sorting. the datasource is filled with the needdatasource event. This funtion puts an IEnumerable<Canidate> into the datasource.
When I click the header of a column for the first time, everything works wel. When I click the header of the column next to the previous column, the column to right of the column I clicked is then sorted. also the sortmode is not changing when click multiple times on the same header. I have also tested this with auto generate columns, but this produces the same error.

Does anyone has an idea what is going on?

here is my code behind:

  protected void CandidateListGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
        { 
            RadComboBox lastNameInput = (RadComboBox)FilterData.FindControl("LastNameInput"); 
            RadComboBox firstNameInput = (RadComboBox)FilterData.FindControl("FirstNameInput"); 
            RadDatePicker dateLastContractFromInput = (RadDatePicker)FilterData.FindControl("DateLastContractFromInput"); 
            RadDatePicker dateLastContractUntilInput = (RadDatePicker)FilterData.FindControl("DateLastContractUntilInput"); 
            RadComboBox StatusComboBox = (RadComboBox)FilterData.FindControl("StatusComboBox"); 
 
            var statusItems = from itm in StatusComboBox.Items 
                              where ((CheckBox)itm.FindControl("CheckBox")).Checked 
                              select itm.Value; 
 
            CandidateListGrid.DataSource = this.presenter.ListCandidates( 
                ((lastNameInput != null) ? lastNameInput.Text : ""
                , ((firstNameInput != null) ? firstNameInput.Text : ""
                , statusItems 
                , ((dateLastContractFromInput != null) ? dateLastContractFromInput.SelectedDate : DateTime.MinValue) 
                , ((dateLastContractUntilInput != null) ? dateLastContractUntilInput.SelectedDate : DateTime.MinValue) 
                ); 
             
        } 

here is my ascx

 <telerik:RadGrid ID="CandidateListGrid" runat="server" AllowPaging="True" AllowSorting="true" GridLines="None" 
        AutoGenerateColumns="False" PageSize="10" 
        AllowMultiRowSelection="True" EnableEmbeddedSkins="False" Skin="USGFOEXTelerik" 
        OnNeedDataSource="CandidateListGrid_NeedDataSource" > 
        <MasterTableView ClientDataKeyNames="ID"
            <Columns> 
                <telerik:GridBoundColumn DataField="LastName" HeaderText="Naam" SortExpression="LastName" 
                    UniqueName="LastName"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="FirstName" HeaderText="Voornaam" SortExpression="FirstName" 
                    UniqueName="FirstName"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ContractState" HeaderText="Status" SortExpression="ContractState" 
                    UniqueName="ContractState"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="LastContractDate" DataType="System.DateTime" 
                    HeaderText="Laatste contract" SortExpression="LastContractDate" UniqueName="LastContractDate"
                </telerik:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
here is my Candidate class:

  public class Candidate 
    { 
        public int Id { getset; } 
        public string FirstName { getset; } 
        public string LastName { getset; } 
        public DateTime LastContractDate { getset; } 
        public string ContractState { getset; } 

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 28 Jun 2010, 12:51 PM
Hello Michaƫl,

I'm afraid that I'm unable to recreate the behavior you have described using the provided information. I have attached a sample test page, please take a look maybe I'm missing something obvious.

Greetings,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michaël Kiekens
Top achievements
Rank 1
answered on 30 Jun 2010, 09:59 AM
your sample application is indeed working. I will try to digg a little deeper to find what combination of controls is causing this.
Thanks for your help already
Tags
Grid
Asked by
Michaël Kiekens
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Michaël Kiekens
Top achievements
Rank 1
Share this question
or