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

Context menu hide ColumnsContainer

2 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
smdk
Top achievements
Rank 1
smdk asked on 09 Dec 2010, 07:45 PM
I don't want to display the column selection option in context menu.

I am able to do that within HeaderContextMenu_PreRender

private void HeaderContextMenu_PreRender(object sender, EventArgs e)
{
    GridHeaderContextMenu menu = sender as GridHeaderContextMenu;
    foreach (RadMenuItem item in menu.Items)
        if (item.Text == "Columns")
        {
            item.Visible = false;
        }
}

But when I click on the menu I get this error in dynamic javascript.
code line:  var h=m.findItemByValue("ColumnsContainer").get_items();
Error: Microsoft JScript runtime error: 'findItemByValue(...)' is null or not an object

Any suggestions?

thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 09 Dec 2010, 07:50 PM
Hello smdk,

I've run into this same issue before. I resolved it by just hiding it like so:

item.Style.Add("display","none");

It just hides it in the browser.

I hope that helps.
0
smdk
Top achievements
Rank 1
answered on 09 Dec 2010, 07:53 PM
Perfect, worked great. Thanks for the quick reply.
Tags
Grid
Asked by
smdk
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
smdk
Top achievements
Rank 1
Share this question
or