show and hide the filter menu options as per columns in radgrid

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    13 posts
    Member since:
    Jan 2012

    Posted 19 May 2014 Link to this post

    Hi ,

      I have developed one telerik grid with filter options on every columns , here I have name column and date column and I need to show and hide the  filter menu options as per the column type for name column  need to hide between and Not Between options and  date  column need to show above two options  but my problem is when I hide the between option in name column it hided  and date column also this action is affected I need to show these two option in date column but not to show name column please help me to do filter menu show hide as per columns and I am using vb for server side code and aspx for design

    below is my code for hide the filter menu option :

      Dim Menu As GridFilterMenu = grdAssessment.FilterMenu
            Dim menuItem As RadMenuItem
            For Each column As GridColumn In grdAssessment.MasterTableView.Columns

                If column.UniqueName = "Name" Then
                    For Each menuItem In Menu.Items
                        If menuItem.Text = "StartsWith" Then
                            menuItem.Text = "Starts With"
                        ElseIf menuItem.Text = "GreaterThanOrEqualTo" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "DoesNotContain" Then
                            menuItem.Text = "DoesNot Contain"
                        ElseIf menuItem.Text = "GreaterThanOrEqualTo" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "GreaterThan" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "LessThan" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "LessThanOrEqualTo" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "EndsWith" Then
                            menuItem.Text = "Ends With"
                        ElseIf menuItem.Text = "NotEqualTo" Then
                            menuItem.Text = "Not Equal To"
                        ElseIf menuItem.Text = "Between" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "NotBetween" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "IsEmpty" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "NotIsEmpty" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "IsNull" Then
                            menuItem.Visible = False
                        ElseIf menuItem.Text = "NotIsNull" Then
                            menuItem.Visible = False
                        End If
                    Next
                ElseIf column.UniqueName = "ProposedStartDate" Then
                    For Each menuItem In Menu.Items
                        If menuItem.Text = "NotBetween" Then
                            menuItem.Visible = True
                            menuItem.Text = "Not Between"
                        ElseIf menuItem.Text = "NoFilter" Then
                            menuItem.Text = "No Filter"
                        ElseIf menuItem.Text = "Between" Then
                            menuItem.Visible = True
                        End If
                    Next
                End If

            Next    





  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 22 May 2014 Link to this post

    Hello Matthew,

    In order to achieve your scenario you could follow the JavaScript approach shown in the article below. The idea is to subscribe to RadGrid FilterMenuShowing event and change the options dynamically. Note that a client-side JavaScript approach is required because the filter options are changed on the client and there is no way to customize the menu based on each column from the server because the changes will be overridden from the client.

    Regards,
    Antonio Stoilkov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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