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

RadGrid - Add MenuITem to HeaderContextMenu Programmatically

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tushar
Top achievements
Rank 1
Tushar asked on 29 May 2014, 10:56 AM
Hi,
I want to add custom menu items to HeaderContextMenu of RadGrid.
I am able to do it from Javascipt OnClientLoad event.

But I want to do this in code behind. I tried following way:

         this.HeaderContextMenu.PreRender += HeaderContextMenu_PreRender;
        void HeaderContextMenu_PreRender(object sender, EventArgs e)
        {
            RadMenuItem resetItem = new RadMenuItem("Reset Columns New");
            resetItem.PostBack = false;
            resetItem.Visible = true;
            this.HeaderContextMenu.Items.Insert(2, resetItem);
        }

But this doesnt add new menu item. Any idea how I can achieve this?














1 Answer, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 03 Jun 2014, 07:15 AM
Hi Tushar,

For your convenience I have prepared a sample project where the functionality is implemented. You would find it as attachment. Give it a try and let me know if it works for you.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Tushar
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or