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

[Solved] Filter template column many fields

1 Answer 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
huynh
Top achievements
Rank 1
huynh asked on 22 Apr 2009, 02:48 AM
Dear,
I create tempalte colum .It contains just one Literal.I bind Data for Literal in ItemDataBound event .I combind data from 3 field on Database.How I can filter this column?
Below is my code:
HTML:
 <telerik:GridTemplateColumn UniqueName="EmployeeInfo" DataType="System.String" AllowFiltering="true" AutoPostBackOnFilter="true" ItemStyle-HorizontalAlign="center" HeaderText="<%$ Resources:Strings, UR000001grvhEmployeeInfo %>"
                HeaderStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <table cellpadding="0" border="0px" cellspacing="0" width="100%" style="overflow: hidden">
                        <tr>
                            <td align="center" style="overflow: hidden">
                                <asp:Literal ID="UR009001litEmployeeInfo" runat="server" />
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Center" Width="80px"></HeaderStyle>
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="true">
                </ItemStyle>
            </telerik:GridTemplateColumn>
ItemDataBoundEvent:
Literal litEmployeeInfo = (Literal)e.Item.Cells[0].FindControl(Constant.UR009001litEmployeeInfo);
 litEmployeeInfo.Text = emp.EmployeeID  + emp.FirstName + emp.SureName;

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Apr 2009, 08:11 AM
Hi,

You can try out the following steps and see if it helps:

  1. Create custom filtering template column .
  2. Save the string sequence from the filter pattern in a Session variable.
  3. Split the parts of the filter pattern and modify the FilterExpression to perform proper filter action.
  4.  Clear the Session variable and the FilterExpression if the filter command is NoFilter.

For more information on thisd refer to the following code library submission. You can alter the logic according to your requirement:
Individual filtering and sorting for "sub-columns" in template column

Thanks
Princy.
Tags
Grid
Asked by
huynh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or