Last Updated: 18 Sep 2019 15:50 by ADMIN
Walter Edwards
Created on: 12 Sep 2019 00:04
Category: Grid
Type: Feature Request
The GridDropDownColumn should natively support displaying / sorting / filtering by TextField (ex. ProductName), but save ValueField (ex. ProductID).
I have NEVER seen a real world UI with a GridDropDownColumn in a Grid where you didn't want to save the ValueField of the GridDropDownColumn (ex. Product ID), but also wanted to display the TextField (ex. Product Name) as well as sort and filter by the TextField.  This functionality should be part of the grid and the default behavior for GridDropDownColumn.
1 comment
Posted on: 18 Sep 2019 15:50
Hi Walter,

Actually, this is supported for sorting by default using the following property:
<telerik:GridDropDownColumn ... SortExpression="TextField" >

However, there is no equivalent property for the filtering functionality and such implementation can be the resolution of this requirement.

Fortunately, there is a very convenient alternative configuration, which allows the exact same thing - using a GridTemplateColumn as suggested in the first green note in this article:

For convenience, I've prepared a direct sample:
<telerik:GridTemplateColumn DataField="TextField"
    FilterControlAltText="Filter TextField column" HeaderText="TextField"
    SortExpression="TextField" UniqueName="TextField">
        <asp:Label ID="Label1" runat="server" Text='<%# Eval("TextField") %>'>
        <telerik:RadDropDownList ID="RadDropDownList1" runat="server"
            SelectedValue='<%# Bind("ValueField") %> '
            DataTextField="TextField" DataValueField="ValueField"
            DataSource='<%# Enumerable.Range(1,80)
                .Select(x=>new { TextField= "Country "+x, ValueField="Name "+ x }) %>'>

Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.