3

Is it possible to implement a context menu which appears when users perform a right-click on an item of interest using the PopupControlExtender?

From investigations so far, it seems like the PopupControlExtender only works with left-clicks or the other choices are to write your own control or implement the entire solution in jQuery.

If it is possible to do a right-click with the PopupControlExtender, may I get some code examples?

methon.dagger
  • 505
  • 9
  • 28

1 Answers1

1

Just have a hidden button on the form for the PopupControlExtender, then capture the right click and call document.getElementById('bla').click();

JS:

$('#element').mousedown(function(event) {
    switch (event.which) {
        case 1:
            //alert('Left mouse button pressed');
            break;
        case 2:
            //alert('Middle mouse button pressed');
            break;
        case 3:
            document.getElementById('bla').click();  
            break;
        default:
            //alert('You have a strange mouse');
    }
});

Markup:

<asp:button id="bla" runat="sever" style="display:none"/>
.....PopupControlExtender code...etc
rick schott
  • 21,012
  • 5
  • 52
  • 81