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

Customizing HeaderContextmenu

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Appu
Top achievements
Rank 1
Appu asked on 01 Jul 2009, 10:08 AM
Hi
How we can disable specific column from displaying it on header context menu. Can i customize in placing  no of columns in HeaderContextmenu.

regards,
Appu
 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 01 Jul 2009, 11:31 AM
Hello Appu,

To hide an item in the header context menu:
protected void Page_Load(object o, EventArgs e) 
    RadGrid1.HeaderContextMenu.ItemCreated += new RadMenuEventHandler(HeaderContextMenu_ItemCreated); 
 
void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e) 
    if (e.Item.Value.Contains("CategoryID")) 
        e.Item.Visible = false

To insert new item in the context menu you could use the OnPreRenderComplete event
protected override void OnPreRenderComplete(EventArgs e) 
    RadContextMenu menu = RadGrid1.HeaderContextMenu; 
    RadMenuItem item = new RadMenuItem(); 
    ... 
    menu.Items.Add(item); 
    base.OnPreRenderComplete(e); 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Appu
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or