8 Answers, 1 is accepted
You can use the ContextMenuOpenning event for this:
private
void
RadGridView1_ContextMenuOpening(
object
sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
if
(e.ContextMenuProvider
is
GridFilterCellElement)
{
e.ContextMenu.Items.RemoveAt(e.ContextMenu.Items.Count - 1);
}
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Hello Dimitar, thank You for quick response but unfortunatelly it didnt help.
Maybe its because i localized this menu before? But I just want to disable "Custom" filter option from Filtering menu, so it should be an simple "inbox" function. I send a screen below.
It works!
Very sorry for my misleading and thanks for yor help :)
You can use the text to remove the item as well:
private
void
RadGridView1_ContextMenuOpening(
object
sender, Telerik.WinControls.UI.ContextMenuOpeningEventArgs e)
{
if
(e.ContextMenuProvider
is
GridFilterCellElement)
{
foreach
(var item
in
e.ContextMenu.Items)
{
if
(item.Text ==
"Custom"
)
{
e.ContextMenu.Items.Remove(item);
break
;
}
}
}
}
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Hi Dimitar!
I've got the same problem, 'cause the 'Custom' option throws an exception.
And additionally I've got a lot of RadGridViews in my solution and I don't want to add this code to all of them.
Is there another solution, which I can implement just one time for the complete solution?
E.g. is it possible to replace the default filter menu with that one w/o the 'Custom' option and assign it to all radgridviews?
Regards
Tom
The context menu is built dynamically at runtime depending on the data type of the field. Because of this, you cannot assign this context menu. I am afraid that in this case there is no simpler solution that can be used for this.
I am not sure why the custom option causes an exception. What I can recommend is posting a ticket and attaching a project that reproduces it. This will allow us to properly investigate the case.
Regards,
Dimitar
Progress Telerik
Hello Dimitar,
I see, in this case a property like 'radGridView1.ShowCustomOptionInStandardFilterMenu=false;' would be helpful, which allows to control this behavior in a one-line-statement unlike the required '_ContextMenuOpening()' - event handler + special treatment for each radgridview.
I don't know, why the option causes an exception, but in fact most users don't really need it. But there are some of them who like to play around with all possible options and report the errors in case of exceptions. I've tried to investigate the error condition but it seems to be out of reach for me even in debug mode. So due to lack of time I decided to deactivate it.
Regards
Tom
Ok, we will consider this and we will add such property if we receive more requests for it.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik