Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Sorting on a column that uses TemplateColumn

Reply
Thread Tools

Sorting on a column that uses TemplateColumn

 
 
Dan
Guest
Posts: n/a
 
      04-04-2004
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>




 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      04-06-2004
Hi,

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

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Dan" <daniel.*NO*chawner@*SPAM*immedient.com> wrote in message
news:(E-Mail Removed)...
> 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>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Sorting list vs sorting vector boltar2003@boltar.world C++ 2 07-06-2010 09:40 AM
fired event Sorting which wasn't handled - sorting and SelectedIndexChanged Jason ASP .Net Web Controls 0 10-04-2006 02:19 PM
sorting by multiple criterias (sub-sorting) Tom Kirchner Perl Misc 3 10-11-2003 05:16 PM
Make DataGrid TemplateColumn read-only in code Bob ASP .Net 0 07-09-2003 05:56 PM



Advertisments