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

Programmatically created Radgrid..... sorting issues

5 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anita
Top achievements
Rank 1
Anita asked on 13 Mar 2010, 08:11 PM
Hi all,

I am new to telerik controls.... I have a radgrid in my application where the columns are generated at runtime based on user selection (user selects the display columns from a checkbox list, and also the number of columns are not fixed). I loop through the collection, and add the colums to the grid in code-behind.  I use the need_DataSource event to bind the grid. The grid displays the data columns correctly based on what the user has clicked. When I click on the column header to sort, the header text disappears, and the column data remain unaltered.
 
I guess I am calling the function which adds columns to the grid in the wrong place. Please any help regarding this would be appreciated. 

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 15 Mar 2010, 12:15 PM
Hi Anita,

Please verify that you follow strictly the conventions for dynamic grid structure creation explained here and the problem should be eliminated.

Regards,
Pavlina
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
Anita
Top achievements
Rank 1
answered on 22 Mar 2010, 05:37 PM
Thanks.
The issue was about adding columns to the collection first, and then set properties.
I was doing the otherway around.
0
Jeremy
Top achievements
Rank 1
answered on 17 May 2010, 04:26 AM
Awesome! Had exactly the same problem. :)

PS link above is slightly broken
0
Mike
Top achievements
Rank 1
answered on 10 Feb 2011, 09:21 PM
I'm having this same problem but have not been able to resolve it.

I am creating the grid in the Page_Init and am creating the columns and their attributes *before* adding them to the column collection (per the help article).

Filtering seems to be working fine but the sorting just doesn't seem to be doing anything other than reloading the grid with the data scrambled rather than sorted. 

I am binding to a declared object data source and have set sort expressions for each column.

Any ideas?

Mike
0
Pavlina
Telerik team
answered on 16 Feb 2011, 12:02 PM
Hello Mike,

Try setting the OverrideDataSourceControlSorting property of the grid to true and let me know if this helps.
OverrideDataSourceControlSorting Property

Greetings,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Anita
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Anita
Top achievements
Rank 1
Jeremy
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Share this question
or