It appears that with the latest SP1 of Q2 2012 (or maybe Q2...not sure when it started happening), the GridHyperLinkColumns are only sortable if you specify "AllowSorting='True'" on them. Before, we were able to just put the SortExpression, like you can do with the GridBoundColumn. It would take me awhile to actually go back to a previous version in order to verify this is really the case, but I am fairly sure that the columns in our app that are GridHyperLinkColumns did use to sort, if they had a SortExpression on them, and now they don't. I verified that the latest version does work this way in a new web application. I can't imagine this behavior would change on purpose. Anyone else experience this one?
Sample code used:
Sample code used:
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TelerikSortTest._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
html
>
<
head
><
title
></
title
></
head
>
<
body
>
<
form
runat
=
"server"
>
<
asp:ScriptManager
runat
=
"server"
ID
=
"ScriptManager1"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
AllowSorting
=
"true"
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridHyperLinkColumn
SortExpression
=
"Name"
HeaderText
=
"Name"
DataTextField
=
"Name"
DataNavigateUrlFormatString
=
"CampaignEdit.aspx?CampaignKey={0}"
DataNavigateUrlFields
=
"PCM_CampaignKey"
/>
<
telerik:GridBoundColumn
SortExpression
=
"Description"
HeaderText
=
"Description"
DataField
=
"Description"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
TelerikSortTest
{
public
partial
class
_Default : Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
var data =
new
[] {
new
{ PCM_CampaignKey = 1, Name =
"Item ABC"
, Description =
"Description ABC"
},
new
{ PCM_CampaignKey = 2, Name =
"Item DEF"
, Description =
"Description DEF"
},
new
{ PCM_CampaignKey = 3, Name =
"Item GHI"
, Description =
"Description GHI"
}};
this
.RadGrid1.DataSource = data;
}
}
}