How can I enter the Value "" (empty string) in the traditional filter system (not Excel like filter).
The grid does not seem to accept an empty string as an argument to "Equals" through the UI.
Ideally I would like to extend the standard filter menu in traditional filtering (and the filter operator drop down in custom filtering dialog) to contain operators "Is Empty" "Is Not Empty" and "Is Null Or Empty", "Is Not Null And Not Empty"
Regards
Erwin
I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
I have also updated your Telerik points.
Hi Dess,
Thanks for your suggestion. I'm a bit reluctant to implement basic required functionality such filtering for empty cells that are not null by myself. Extending the Menu as you suggested would lead to inconsistencies in the Custom Filter Dialog I guess.
My suggestion would be that Telerik implement the missing Filters such as Empty, Not Empty to be consistently available in the UI or at least allow to somehow enter an "Equals" condition to an empty string in the custom filter dialog, so that the user could construct a condition like "is null or empty".
Regards
Erwin
public
RadForm1()
{
InitializeComponent();
this
.radGridView1.Columns.Add(
"Number"
);
this
.radGridView1.Columns.Add(
"TextColumn"
);
this
.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
this
.radGridView1.EnableFiltering =
true
;
this
.radGridView1.ShowHeaderCellButtons =
true
;
this
.radGridView1.Rows.Add(1,
""
);
this
.radGridView1.Rows.Add(2,
" "
);
this
.radGridView1.Rows.Add(3,
null
);
this
.radGridView1.Rows.Add(4,
"test"
);
this
.radGridView1.ContextMenuOpening += radGridView1_ContextMenuOpening;
}
private
void
radGridView1_ContextMenuOpening(
object
sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
GridFilterCellElement filterCell = e.ContextMenuProvider
as
GridFilterCellElement;
if
(filterCell !=
null
&& filterCell.ColumnInfo
is
GridViewTextBoxColumn)
{
RadMenuItem emptyItem =
new
RadMenuItem(
"IsEmpty"
);
emptyItem.Tag = filterCell.ColumnInfo.Name;
emptyItem.Click += emptyItem_Click;
e.ContextMenu.Items.Add(emptyItem);
}
}
private
void
emptyItem_Click(
object
sender, EventArgs e)
{
RadMenuItem item = sender
as
RadMenuItem;
string
propertyName = item.Tag +
""
;
FilterDescriptor fd =
new
FilterDescriptor();
fd.PropertyName = propertyName;
fd.Operator = FilterOperator.IsEqualTo;
fd.IsFilterEditor =
true
;
fd.Value =
""
;
this
.radGridView1.FilterDescriptors.Add(fd);
}