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

[Solved] templatecolumn filter works but sorting doesn't

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sf
Top achievements
Rank 1
sf asked on 11 Mar 2010, 03:21 AM

I have a gridtemplatecolumn (see code below) the filter works fine but the sorting doesn't, the header is not clickable for sorting. Once I take out the binding in HeaderTemplate the sorting worked. I need to have this binding for runtime defined currency symbol, is there a way that i can make the sorting work on this column with this type of binding on headertemplate?

<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px" FilterControlWidth="60px" UniqueName="theAmount" DataField="theAmount" SortExpression="theAmount">  
                                    <HeaderTemplate> 
                                        <%# "theAmount (" + MY_BLL.Settings.Default.CurrencySymbol + ")"%> 
                                    </HeaderTemplate> 
                                    <ItemTemplate> 
                                        <%# Eval("theAmount", "{0:N}")%> 
                                    </ItemTemplate> 
</telerik:GridTemplateColumn> 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Mar 2010, 08:36 AM

Hello,

Try adding LinkButton in HeaderTemplate as shown below and see whether it helps.

ASPX:

 
    <HeaderTemplate>  
        <asp:LinkButton ID="SortMe" CommandName="Sort" CommandArgument="theAmount" runat="server" Text='<%# "theAmount (" + MY_BLL.Settings.Default.CurrencySymbol + ")"%>'></asp:LinkButton>  
    </HeaderTemplate> 

-Shinu.

0
sf
Top achievements
Rank 1
answered on 11 Mar 2010, 08:57 AM
thanks shinu, I added in this linkbutton. At runtime when mouse-over the heading the cursor changes to hand-shape, but after click on the heading nothing happens....
Tags
Grid
Asked by
sf
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
sf
Top achievements
Rank 1
Share this question
or