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

Need to show Value instead of Key while filtering.

2 Answers 31 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Anand
Top achievements
Rank 1
Anand asked on 22 Sep 2011, 11:06 AM
Hi I am using Rad Silverlight gridview and in that I am generating the Gridview columns by my DataGrid helper class, When any EnityEnum value is coming , with Key and values the Grid is showing the key in the filter, please suggest me how to achive, by code behind in VB or C#. please see the attachment (Screen Shot).

I need to show like 'In development' etc... in the filtering box. plz help ASAP.
Thanking you for this. 

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 22 Sep 2011, 11:26 AM
Hello Anand,

You can use an IValueConverter on the column's DataMemberBinding in order to transform the raw enum value into the human-friendly value.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Anand
Top achievements
Rank 1
answered on 22 Sep 2011, 12:42 PM
Thank you for the reply, can you please show me any sample code, as I am not fully understand the concept.

I have written code like this:
                        newCol.UniqueName = col.ColID
                        Dim customFilter As New CustomizedFilteringControl
                        newCol.FilteringControl = customFilter
 
'And the class CustomizedFilteringControl is like:
 
 
Public Class CustomizedFilteringControl
    Inherits FilteringControl
    Public Overrides Sub Prepare(ByVal column As GridViewBoundColumnBase)
        MyBase.Prepare(column)
 
        Dim availableOperators = New List(Of FilterOperator)(New FilterOperator() {FilterOperator.Contains, FilterOperator.IsEqualTo, FilterOperator.IsNotEqualTo, FilterOperator.StartsWith, FilterOperator.EndsWith, FilterOperator.DoesNotContain, FilterOperator.IsContainedIn})
 
        Dim cbo1 = Me.ChildrenOfType(Of RadComboBox)().Where(Function(b) b.Name = "PART_Filter1ComboBox").FirstOrDefault()
        cbo1.SelectedValue = availableOperators.FirstOrDefault()
        cbo1.ItemsSource = availableOperators
 
        Dim cbo2 = Me.ChildrenOfType(Of RadComboBox)().Where(Function(b) b.Name = "PART_Filter2ComboBox").FirstOrDefault()
        cbo2.SelectedValue = availableOperators.FirstOrDefault()
        cbo2.ItemsSource = availableOperators
    End Sub
End Class

Please help me. 
Thanking you for this.
Tags
DataFilter
Asked by
Anand
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Anand
Top achievements
Rank 1
Share this question
or