Need to show Value instead of Key while filtering.

3 posts, 0 answers
  1. Anand
    Anand avatar
    2 posts
    Member since:
    Sep 2011

    Posted 22 Sep 2011 Link to this post

    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. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 22 Sep 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Anand
    Anand avatar
    2 posts
    Member since:
    Sep 2011

    Posted 22 Sep 2011 Link to this post

    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.
Back to Top