We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can I have a sample for the datagrid search form ?

Thread ID:

Created:

Updated:

Platform:

Replies:

121720 Jan 19,2016 03:04 PM UTC Jan 27,2016 11:26 AM UTC WPF 5
loading
Tags: SfDataGrid
Silvio
Asked On January 19, 2016 03:04 PM UTC

Hi, 

I'm very interested to the Search form for the SfDatagrid that I see on the online demos (see attached image).
But I don't find the code example on my own installation.
Is there a link where I can download the code example ?
Thank you in advance.

Silvio

Attachment: Syncfusion_98d35bfd.zip

Sowndaiyan Paulpandi [Syncfusion]
Replied On January 20, 2016 12:57 PM UTC

Hi Silvio,

Thanks for contacting Syncfusion Support.

We have provided this “search” support from our Essential Studio Volume 4, 2015 (Version 13.4.0.53). So we recommend you to use our latest version 13.4.0.53 to use this “search” support and is available for download under the following link.
 

http://www.syncfusion.com/forums/121657/essential-studio-2015-volume-4-final-release-v13-4-0-53-is-available-for-download                                             

Regards,

Sowndaiyan


Silvio
Replied On January 23, 2016 07:54 AM UTC

I've tried the search control and it works.
However I had to make 2 changes on your code not to have crashes on my own example.

First of all: 

       static SearchControl()
        {
          DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchControl), new FrameworkPropertyMetadata(typeof(SearchControl)));
        }

        public SearchControl()
        {
        }

I have inserted the static constructor and the OverrideMetadata is called inside it. Otherwise, the second time you create the same control you'd have a crash.


Secondly, I had to make this change:


        private void OnComboBoxSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
          if (e.RemovedItems.Count == 0 || e.AddedItems.Count == 0)
            return;
            var oldItem = e.RemovedItems[0];
            var newItem = e.AddedItems[0];
            if (oldItem == null || newItem == null)
                return;
            var oldGrid = this.GetDataGrid(oldItem.ToString());
            var newGrid = this.GetDataGrid(newItem.ToString());
            oldGrid.SearchHelper.ClearSearch();
            newGrid.SearchHelper.AllowFiltering = (bool)this.ApplyFilterCheckBox.IsChecked;
            newGrid.SearchHelper.Search(SearchTextBox.Text);
        }

Without the inserted red lines I had cases (closing the form) where e.AddedItems was empty and an IndexOfRangeException was thrown.

Now I have a question for you. This control seems to search for only Text cells. But what about searching also for combo-box value cells? Should it be possible ?

Have a nice day !

Ganeshkumar Lingappan [Syncfusion]
Replied On January 25, 2016 05:39 PM UTC

Hi Silvio,

ComboBox column loads content presenter to provide support for template. You can enable search in combobox column by loading TextBlock by writing custom renderer. We have prepared and attached the sample for the ComboBox column Search for your Reference. Find the sample from below location.

Sample Location : http://www.syncfusion.com/downloads/support/forum/121720/ze/CS2017765198

Please let us know if you need further assistance.

Regards,
Ganeshkumar

Silvio
Replied On January 26, 2016 04:25 PM UTC

Thank you for your assistance.
It works with GridComboBoxColumn.

Is there a similar example also with GridMultiColumnDropDownList ?

Thank you in advance.

Ambarish Srinivasan [Syncfusion]
Replied On January 27, 2016 11:26 AM UTC

Hi Silvio,

By default search supported with GridMultiColumnDropDownList. Please find the sample where search working fine without any changes,
Sample

Regards,
Ambarish.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;