Sorting on a column that uses TemplateColumn

D

Dan

All,
In order to make a column a clickable link (with 2 url parameters), I used a
TemplateColumn with a Hyperlink Item template. That works great. However,
I would like to be able to sort on that column as well. I am sorting on all
of the other columns in the datagrid already.

How can I make this column sortable?

Code snippet:

<asp:TemplateColumn HeaderText="Client Name">
<ItemTemplate>
<asp:HyperLink Runat=server
Text='<%# DataBinder.Eval(Container.DataItem,"Client_Name") %>'
NavigateUrl = '<%# "Client_Details.aspx?EnhId=" +
DataBinder.Eval(Container.DataItem,"Enhancement_ID") + "&ClientId=" +
DataBinder.Eval(Container.DataItem,"Client_ID") %>'
Target=_blank />
</ItemTemplate>
</asp:TemplateColumn>
 
T

Teemu Keiski

Hi,

if I understood right what you mean, you can specify SortExpression for
TemplateColumn like for any other column.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top