Filter a template column with values from multiple datafields

7 posts, 0 answers
  1. Andrew
    Andrew avatar
    1 posts
    Member since:
    Aug 2013

    Posted 02 Aug 2013 Link to this post

    I have a grid with a template column that contains values from two datafields.
    How do I get the filtering to work on this column?

    <telerik:GridTemplateColumn UniqueName="Name" HeaderText="Name" >
     <ItemTemplate>
       <asp:Label ID="lblFirstName" runat="server" Text='<%# Eval("FirstName") %>'></asp:Label
       <asp:Label ID="lblLastName" runat="server" Text='<%# Eval("LastName") %>'></asp:Label>
     </ItemTemplate>
    </telerik:GridTemplateColumn>
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Aug 2013 Link to this post

    Hi Andrew,

    For a GridTemplateColumn,we have a property AllowFiltering,this has to be true,and a DataField property is required to filter the items for that column.If you want to filter by FirstName,give DataField="FirstName" else DataField="LastName".
    Hope this helps.

    Thanks,
    Princy
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tom Lynch
    Tom Lynch avatar
    78 posts
    Member since:
    Mar 2005

    Posted 24 Jun 2014 in reply to Princy Link to this post

    But how do make the filter operate using the values of both FirstName and LastName?  Can you define it like, DataField="FirstName, LastName" or is it more complicated than that?  I'm currently using version 2010.2.929.20 of Telerik.Web.UI.dll.  I know I ought to upgrade, but that's not possible at the moment.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Jun 2014 in reply to Tom Lynch Link to this post

    Hi Tom Lynch,

    I'm afraid currently RadGrid doesn't support passing multiple DataFields for filtering. You can have only either the filter to be done using FirstName or LastName according to the DataField set.

    Thanks,
    Princy
  6. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 22 Nov 2015 in reply to Princy Link to this post

    Hello,

    Is it still impossible to filter on two or more datafields in one template column ?

    Than you

    Vasssek

  7. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Nov 2015 Link to this post

    Hi Vasssek,

    Yes, this depends on the DataField property of the column, which can be set to only to a single database. Nevertheless, you can use a custom solution to create a new type of column as demonstrated in the attached web site sample and handle its filter expression manually.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 30 Nov 2015 in reply to Eyup Link to this post

    Hello,

     

    thank you for your example. I solved my issue on SQL side, but I really appreciate it because of interesting custom databound column class. Maybe, I wil use something like this in my next project :-).

    Vasssek

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017