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

Is the templete column which has two datafind combination sortable?

1 Answer 16 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Amy Liu
Top achievements
Rank 1
Amy Liu asked on 19 Aug 2011, 09:13 PM
I want to combin two data fields into one column and want it to be sortable.

Can it be sortable and how?

 

 

<telerik:GridTemplateColumn DataField='company_id,order_no' DataType="System.Int32"

 

 

 

HeaderText="CompanyOrder" SortExpression='company_id,order_no' UniqueName="companyorder">

 

 

 

<EditItemTemplate>

 

 

 

<asp:TextBox ID="order_noTextBox" runat="server" Text='<%#Bind("company_id") +"-"+Bind("order_no") %>'></asp:TextBox>

 

 

 

</EditItemTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="order_noLabel" runat="server" Text='<%# Eval("company_id")+ "-"+ Eval("order_no") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

Thanks for any advice.

Amy

 

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 20 Aug 2011, 12:14 PM
Hello,

<telerik:GridTemplateColumn UniqueName="TemplateColumn" SortExpression="CompanyName"
                        InitializeTemplatesFirst="false">
                        <FooterTemplate>
                            Template column footer</FooterTemplate>
                        <FooterStyle VerticalAlign="Middle" HorizontalAlign="Center" />
                        <HeaderTemplate>
                            <table id="Table1" cellspacing="0" style="width:240px;" class="myTable">
                                <tr>
                                    <td colspan="2" align="center">
                                        <b>Contact details</b></td>
                                </tr>
                                <tr>
                                    <td style="width: 50%">
<asp:LinkButton CssClass="Button" ID="btnContName" Text="Contact name" ToolTip="Sort by ContactName"
CommandName='Sort' CommandArgument='ContactName' runat="server" /></td>
                                    <td style="width: 50%">
<asp:LinkButton CssClass="Button" ID="btnContTitle" Text="Contact title" ToolTip="Sort by ContactTitle"
CommandName='Sort' CommandArgument='ContactTitle' runat="server" /></td>
                                </tr>
                            </table>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <table cellspacing="0" width="100%" class="myTable">
                                <tr>
                                    <td style="width: 50%">
                                        <%# Eval("ContactName") %>
                                    </td>
                                    <td style="width: 50%">
                                        <%# Eval("ContactTitle") %>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>

for more information please check Template Column In Grid / Column Types

Let me know if any concern.

Thanks,
Jayesh Goyani
Tags
General Discussions
Asked by
Amy Liu
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or