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

Column Sorting

1 Answer 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
New User
Top achievements
Rank 1
New User asked on 22 Jul 2011, 08:31 PM
I currently have a grid with 1 column split into 2 based on a GridTemplateColumn I'm trying to figure out how to sort each of the separate columns by 2 different fields.  Here is my code for my grid. 

 

<

 

telerik:RadGrid ID="grdCurrentandPrior" runat="server" AllowSorting="True" AutoGenerateColumns="False"

 

 

 

 

 

 

GridLines="None" Skin="Web20" Style="margin-right: 0px" Width="673px" Height="260px"

 

 

 

 

 

 

OnNeedDataSource="grdCurrentandPrior_NeedDataSource" OnItemDataBound="grdCurrentandPrior_ItemDataBound">

 

 

 

 

 

 

<ExportSettings FileName="OpenItemsCurrentInventory" IgnorePaging="True" OpenInNewWindow="True">

 

 

 

 

 

 

<Excel Format="HTML" />

 

 

</ExportSettings>

 

 

 

 

 

 

<MasterTableView CommandItemDisplay="Bottom" AllowNaturalSort="false">

 

 

 

 

 

 

<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false"/>

 

 

 

 

 

 

<Columns>

 

 

<telerik:GridTemplateColumn HeaderText="Assignee" UniqueName="Assignee" SortExpression="Assignee">

 

 

 

 

 

 

<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" />

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:Label ID="lbAssignee" runat="server" Text='<%# Eval("Assignee") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Jurisdictions" UniqueName="JurisdictionCount" SortExpression="JurisdictionCount">

 

 

 

 

 

 

<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" />

 

 

 

 

 

 

<ItemTemplate >

 

 

 

 

 

 

<asp:Label ID="lbJurisdiction" runat="server" Text='<%# Eval("JurisdictionCount") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

 

 

 

 

<ItemStyle HorizontalAlign="Right" ForeColor="Black" />

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

 

<telerik:GridTemplateColumn UniqueName="TemplateColumn">

 

 

 

 

 

 

<HeaderTemplate>

 

 

 

 

 

 

<table id="Table1" cellspacing="1" cellpadding="1" width="200px" border="1">

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

<td colspan="2" align="center">

 

 

 

 

 

 

<b>Open Items by Age</b>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

<td align="center" width="50%">

 

 

 

 

 

 

<b>Prior</b>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

<td align="center" width="50%">

 

 

 

 

 

 

<b>Current</b>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

</table>

 

 

 

 

 

 

</HeaderTemplate>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<table id="Table2" cellspacing="1" cellpadding="1" width="260px" border="1">

 

 

 

 

 

 

<tr>

 

 

 

 

 

 

<td width="50%">

 

 

 

 

 

 

<asp:Label ID="lblPriorCount" runat="server" Text='<%# Eval("OpenItemsCountPrior") %>'></asp:Label>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

<td width="50%">

 

 

 

 

 

 

<asp:Label ID="lblCurrentCount" runat="server" Text='<%# Eval("OpenItemsCountELD") %>'></asp:Label>

 

 

 

 

 

 

</td>

 

 

 

 

 

 

</tr>

 

 

 

 

 

 

</table>

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Items Left to Pay" UniqueName="TotalRemainingItems" SortExpression="TotalRemainingItems">

 

 

 

 

 

 

<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" />

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:Label ID="lblPctComplete" runat="server" Text='<%# Eval("TotalRemainingItems") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

 

 

 

 

<ItemStyle HorizontalAlign="Right" ForeColor="Black" />

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="% Complete" UniqueName="clmPctComplete">

 

 

 

 

 

 

<HeaderStyle Font-Bold="True" Width="100px" HorizontalAlign="Center" />

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:Label ID="lblPctComplete" runat="server" Text='<%# Eval("TotalRemainingItems") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

 

 

 

 

<ItemStyle HorizontalAlign="Right" ForeColor="Black" />

 

 

 

 

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="AssigneeEmployeeKey" ReadOnly="True" UniqueName="AssigneeEmployeeKey"

 

 

 

 

 

 

Visible="False">

 

 

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

</Columns>

 

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

 

<HeaderStyle BorderStyle="Solid" />

 

 

 

 

 

 

 

<ClientSettings>

 

 

 

 

 

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

 

 

 

 

 

</ClientSettings>

 

 

 

 

 

 

</telerik:RadGrid>

 




Thanks
Kristi

1 Answer, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 26 Jul 2011, 02:27 PM
Hello,

You could manually add custom filter expression. Check this online demo and examine its code.
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/sort/defaultcs.aspx

Let us know if you need more help.

Greetings,
Vasil
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
New User
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or