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

radfileexplorer custom column sorting

3 Answers 113 Views
Telerik Trainer
This is a migrated thread and some comments may be shown as answers.
Billy
Top achievements
Rank 1
Billy asked on 05 Jul 2013, 07:47 PM

I have a radfileexplorer with three custom columns that are created like this: 

// Sets up a gridTemplateColumn for the Owner

GridTemplateColumn gtcOwner = new GridTemplateColumn();

gtcOwner.HeaderText = "Owner Name";

gtcOwner.UniqueName = "Owner";

gtcOwner.DataField = "Owner";

gtcOwner.SortExpression = "Owner";

rfe.Grid.Columns.Add(gtcOwner);

// Set up a gridTemplateColumn for the upload date

GridTemplateColumn gtcDate = new GridTemplateColumn();

gtcDate.HeaderText = "Date";

gtcDate.UniqueName = "Date";

gtcDate.DataField = "Date";

gtcDate.SortExpression = "Date";

rfe.Grid.Columns.Add(gtcDate);

//Sets up gridTemplateColumn for Visibility

GridTemplateColumn gtcPermission = new GridTemplateColumn();

gtcPermission.HeaderText = "Permission";

gtcPermission.UniqueName = "Visibility";

gtcPermission.DataField = "Visibility";

gtcPermission.SortExpression = "Visibility";

gtcPermission.HeaderStyle.Width = Unit.Pixel(72);

rfe.Grid.Columns.Add(gtcPermission);

When I click the column header the sort icon changes and the content sorts once. Subsequent clicks produce no change. The filename and size columns sort as expected.

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 10 Jul 2013, 12:49 PM
Hello Billy,

When creating template columns programmatically, you must create the templates dynamically in the code-behind and assign them to the ItemTemplate and EditItemTemplate properties of the column. I would recommend you to review the following help article which elaborates more on this matter.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Billy
Top achievements
Rank 1
answered on 19 Jul 2013, 09:07 PM
I believe the problem is because I'm not creating the grid template columns in the Page_Init() method. Is there a way to grab a column click event and sort client side?
0
Kostadin
Telerik team
answered on 24 Jul 2013, 10:35 AM
Hi Billy,

Client side sorting is supported only with client side databinding. Please check out the following demos:
Grid - Declarative Binding
Grid - Client-Side Binding and Caching
If you want only to fire the sort command on the client you could use the client side sort() method.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Telerik Trainer
Asked by
Billy
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Billy
Top achievements
Rank 1
Share this question
or