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

FilterText Box need to replaced with ComboBox

2 Answers 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hemanth
Top achievements
Rank 1
Hemanth asked on 13 Dec 2012, 12:28 PM
Hi,

In my SL application, i m generating columns dynamically in radgrid, even i have filters  and FilteringMode="FilterRow",
now for filtering i have textbox, but i need to replace that textbox with ComboBox and bind data to that.

can someone help me..


Thanks

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 13 Dec 2012, 12:33 PM
Hi,

The documentation is a good place to start.

Greetings,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Hemanth
Top achievements
Rank 1
answered on 14 Dec 2012, 05:57 AM
Thanks Rossen for quick response,

everything is ok for me, i m taking RadComboBox as filter

on FilterEditorCreated, i m binding value to it, values are binding but they are not displayed


 if (e.Column.UniqueName.ToLower() == "text")
            {
                Telerik.Windows.Controls.RadComboBox rcb = e.Editor as Telerik.Windows.Controls.RadComboBox;
                if (rcb != null)
                {

objService.ServiceMethodCompleted += (s, evt) =>
                        {
                            //rcb.ItemsSource = evt.Result;

                            List<String> lstitems = (List<String>)evt.Result;
                            for (int i = 0; i < lstitems .Count; i++)
                            {
                                //rcb.DisplayMemberPath = lstitems [i];
                                rcb.Items.Add(lstitems [i]);
                            }

                        };
                    objService.ServiceMethodAsync();

                  }
can u say where i m going wring?


and my FilterEditor class


 public class BindDDLforFilter : Telerik.Windows.Controls.GridViewDataColumn
    {
        public override FrameworkElement CreateFieldFilterEditor()
        {
            Telerik.Windows.Controls.RadComboBox radComboBox = new Telerik.Windows.Controls.RadComboBox();
            // This binding will transfer the significant property of your editor to the filtering view model.
            Binding selectedValueBinding = new Binding("Value");
            selectedValueBinding.Converter = new ComboBoxFilterEditorConverter();

            radComboBox.SetBinding(Telerik.Windows.Controls.RadComboBox.SelectedValueProperty, selectedValueBinding);
            return radComboBox;
        }

        private class ComboBoxFilterEditorConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                if (Object.Equals(value, Telerik.Windows.Data.FilterDescriptor.UnsetValue))
                {
                    // When the filter is turned off this is what editor will get.
                    return null;
                }
                return value;
            }

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                if (value == null)
                {
                    // When your editor want to turn off the filter this is what it should return.
                    return Telerik.Windows.Data.FilterDescriptor.UnsetValue;
                }
                return value;
            }
        }
    }
Tags
GridView
Asked by
Hemanth
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Hemanth
Top achievements
Rank 1
Share this question
or