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

[Solved] Attach radcontextmenu to header

1 Answer 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ahrensberg
Top achievements
Rank 1
Ahrensberg asked on 16 Mar 2010, 09:34 AM
Hello all,

I want to give my users some other options for my radgrid, than the options given by the default headercontextmenu, and have instead choosen to use a radcontextmenu. This contextmenu can I unfortunately not attach to the header only, but only to the full grid. What should I do to set only the header as target, since I want different menues for the header and for the item-row.

Cheers,
Kenneth

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Mar 2010, 12:03 PM

Hello Kenneth,

You need to attach 'OnHeaderMenuShowing' event and show the menu on header as shown below.

JavaScript:

 
<script type="text/javascript">  
    function OnHeaderMenuShowing(sender, eventArgs) {  
        eventArgs.set_cancel(true);  
 
        var headerName = eventArgs.get_gridColumn().get_uniqueName();  
 
        var menu = $find("<%=RadMenu1.ClientID %>");  
        var evt = eventArgs.get_domEvent();  
 
        menu.show(evt);  
        evt.cancelBubble = true;  
        evt.returnValue = false;  
 
        if (evt.stopPropagation) {  
            evt.stopPropagation();  
            evt.preventDefault();  
        }  
    }  
</script> 

-Shinu.

Tags
Grid
Asked by
Ahrensberg
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or