Unplanned
Last Updated: 26 Mar 2021 11:39 by ADMIN
Chuck
Created on: 03 Feb 2020 20:33
Category: GridView
Type: Feature Request
0
RadGridView: Add new RadFilterOperationMenuItems - DoesNotStartsWith/DoesNotEndsWith
I was creating a table with filters when I noticed that there is an option in the filters for 'EndsWith' but not one for 'DoesNotEndWith'. We use internal part numbers for our products where the last 3 digits determine the department in which the product was made. Because wildcards cannot be used within the RadGridView filters, I am having to create a unusual workaround. The same can be said about 'DoesNotBeginWith'.
2 comments
ADMIN
Nadya | Tech Support Engineer
Posted on: 26 Mar 2021 11:39

Hello,

You can use the following workaround:

 public partial class RadForm1 : Telerik.WinControls.UI.RadForm
 {
     public RadForm1()
     {
         RadGridLocalizationProvider.CurrentProvider = new MyRadGridLocalizationProvider();
         InitializeComponent();

         this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
         this.radGridView1.EnableFiltering = true;
         this.radGridView1.MasterTemplate.ShowFilteringRow = true;

         this.radGridView1.FilterExpressionChanged += this.RadGridView1_FilterExpressionChanged;

         this.radGridView1.ContextMenuOpening += this.RadGridView1_ContextMenuOpening;
     }

     private void RadGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
     {
         if (e.ContextMenu.Items[0] is RadFilterOperationMenuItem)
         {
             foreach (RadMenuItemBase menuItem in e.ContextMenu.Items)
             {
                 if (string.Equals("Starts with", menuItem.Text))
                 {
                     menuItem.Text = "Does not starts with";
                 }
             }
         }
     }

     private void RadGridView1_FilterExpressionChanged(object sender, FilterExpressionChangedEventArgs e)
     {
         var ex = e.FilterExpression;
         if (ex.Contains("LIKE") && ex.Contains("%"))
         {
             this.radGridView1.FilterExpressionChanged -= this.RadGridView1_FilterExpressionChanged;
             e.FilterExpression = ex.Replace("LIKE", "NOT LIKE");
             this.radGridView1.FilterExpressionChanged += this.RadGridView1_FilterExpressionChanged;
         }
     }

     private void RadForm1_Load(object sender, EventArgs e)
     {
         this.customersTableAdapter.Fill(this.nwindDataSet.Customers);

     }
 }
 public class MyRadGridLocalizationProvider : RadGridLocalizationProvider
 {
     public override string GetLocalizedString(string id)
     {
         switch (id)
         {
             case RadGridStringId.FilterOperatorStartsWith:
                 return "Does not starts with";
             default:
                 return base.GetLocalizedString(id);
         }
     }
 }

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Attached Files:
ADMIN
Nadya | Tech Support Engineer
Posted on: 10 Feb 2020 09:35

Hello Chuck,

Thank you for the provided information. I found this a reasonable case and I approved it as a feature request. You can track its progress, subscribe for status changes on the following feedback item. Note, that you can add your vote for it in order to increase its priority. The more votes an item gathers the higher its priority becomes. 

As a reward, I updated your Telerik Points.

Do not hesitate to contact us if you have any other questions or concerns.

Regards,
Nadya
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.