0

I have a button inside a gridview.

What I need to do is:

  1. OnClick (Left) - show a modal pop-up
  2. Right Click- show a baloon pop-up

I coded the button onclick using Gridview RowCommand:

  Private Sub Gridview1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles Gridview1.RowCommand

        Dim index = Convert.ToInt32(e.CommandArgument)
        Dim row = Gridview1.Rows(index)
        Button1_ModalPopupExtender.Show()
        ''do something

  End Sub

How do I fire the right click event in this case? (or is it even possible?)

Thanks

lulutanseco
  • 313
  • 1
  • 8
  • 29

1 Answers1

4

If you are familiar with Jquery then you can use the context menus instead to accomplish your requirement.

$(document).ready(function(){ 
  document.oncontextmenu = function() {
          return false;
     };
    
  $(document).mousedown(function(e){ 
    if( e.which == 2 ) { 
      alert('Right clicked'); 
//Here you can write the code to show the modal popup
          return false; 
        }  
      }); 
    });

For details on contextmenu pls go thru Right Click

In the click event, you can actually write the code to display your baloon popup.

Hope this helps :)

Community
  • 1
  • 1
D.T.
  • 350
  • 1
  • 4
  • Hello! It does work. thank you very much! One question though, is it possible to incorporate complex conditional codes inside a jquery? I actually have four balloon pop-ups which would appear depending on what button was clicked (there are, consequently, four buttons as well) – lulutanseco Sep 24 '14 at 12:36
  • Yes, you can differentiate by using `this`, this keyword will give the information on which button is currently clicked – D.T. Sep 24 '14 at 12:40
  • oh. okay! I am currently studying basic jquery syntax. It seems there is really a need to study this. Thank you very very much! :D – lulutanseco Sep 24 '14 at 12:44
  • ur always welcome :) Any ways for a basic idea... if you are in a click event or a loop i.e. '.each', *this* will return you the instance on which click is fired or the current element if you are considering a loop – D.T. Sep 24 '14 at 12:49