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

Multi-Sorting in a Template column

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Iron
Paul asked on 10 Apr 2013, 10:10 PM
Here's my following code:

<telerik:GridTemplateColumn UniqueName="UserName" DataField="FirstName" DataType="System.String" AllowFiltering="false" SortExpression="FirstName">
                <HeaderTemplate>
                      <asp:LinkButton id="btnName" runat="server"
                         Text="Name"
                         Title="Sort by Name"
                         CommandName='Sort'
                         CommandArgument='FirstName' />
                    </HeaderTemplate>
                    <ItemTemplate>
                                        <span class="ListTitle" style="font-size: 14px;">
                                        <%#Container.DataItem("FirstName")%> <%#Container.DataItem("LastName")%></span><br />
                                        <div class="QuestionDetails">
                                        <strong><%#Container.DataItem("EmailAddress")%></strong>
                                        </div>
                    </ItemTemplate>                
                </telerik:GridTemplateColumn>

It sorts properly and highlights the selected sorting column. I know that to do multiple sorting in a single template column you just add another link button with the new field to be sorted like similar to what this is doing here: http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultvb.aspx?#qsf-demo-source .The issue i see from that demo and my page is that it no longer highlights the sorted column if i add another link button in the header template. My question is how do i set it that it highlights if i select either sorting button?





1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 15 Apr 2013, 08:19 AM
Hello Paul,

Please try implementing Multi-Column Headers and let me know if it works for you:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/multicolumnheaders/defaultcs.aspx

Greetings,
Eyup
the Telerik team
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 their blog feed now.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Iron
Answers by
Eyup
Telerik team
Share this question
or