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

Opening the HeaderContextMenu on a Button Click

4 Answers 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kencox
Top achievements
Rank 1
kencox asked on 30 Jul 2009, 04:21 AM
Hi folks,

I really like the show/hide columns functionality built into the context menu (EnableHeaderContextMenu). However, I can't count on users to right-click to open the menu.

To cover myself, I'd like to put a button in the command area that will open the header context menu so they can see it.

As an alternative, I'd be interested in seeing sample code to implement the show/hide column checkboxes in a regular menu or dropdown. 

Thanks!

Ken

4 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 05 Aug 2009, 06:47 AM

Hi Ken,

You can show the menu, as demonstrated in the code snippet below:

<asp:Label runat="server" ID="Label1" Text="ShowContextMenu" onclick="ShowMenu();"></asp:Label>

<telerik:RadScriptBlock runat="server" ID="RadScriptBlock">

            <script type="text/javascript"> 
   
            function ShowMenu()
            {
            var RadGrid = $find("<%=RadGrid1.ClientID %>");           
            RadGrid.get_headerMenu().show(window.event);
            }

            </script>

        </telerik:RadScriptBlock>     

I hope this helps.

Regards,

Yavor
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.
0
Sandeep Trivedi
Top achievements
Rank 1
answered on 15 Dec 2009, 04:50 AM
Hi

When i clicked directly on  "ShowContextMenu" without clicking any where in header.It shows the context menu with all columns in unchecked state in columns menu and when i checked/unchecked the infant of columns name then radgrid is not refreshed .I want it show checked/unchecked columns in the basis on columns shows in rad grid.

Thanks
Sandeep Trivedi

0
Yavor
Telerik team
answered on 18 Dec 2009, 07:33 AM
Hello Sandeep,

 In this case, you can use a standard RadMenu, which will be shown when clicking on the label. This will allow you to customize it either statically, or dynamically, when showing it.
I hope this is a feasible approach for you.


Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Andrey
Top achievements
Rank 1
answered on 11 Jan 2012, 09:25 AM
How I can add action for show headercontextmenu.
for example:
I want open headercontextmenu using OnTouchMove.

Thanks!
Tags
Grid
Asked by
kencox
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Sandeep Trivedi
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Share this question
or