Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. popup menu on right click on datagrid

popup menu on right click on datagrid

Scheduled Pinned Locked Moved ASP.NET
javascripthelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 2 Offline
    2 Offline
    2489128
    wrote on last edited by
    #1

    i want a popup menu on right click on the datagrid at client side using javascript. please help me. sam.

    R 1 Reply Last reply
    0
    • 2 2489128

      i want a popup menu on right click on the datagrid at client side using javascript. please help me. sam.

      R Offline
      R Offline
      RaghuSanta
      wrote on last edited by
      #2

      Create a div element and place the datagrid inside it. Then insert the below mentioned javascript(Popup menu script-Dynamicdrive.com) in the head of the page. Call this javascript from div element "oncontextmenu" //DynamicDrive.com var defaultMenuWidth="150px" //set default menu width. var linkset=new Array() //SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT linkset[0]='<a href="http://dynamicdrive.com">Dynamic Drive</a>' linkset[0]+='<hr>' //Optional Separator linkset[0]+='<a href="http://www.javascriptkit.com">JavaScript Kit</a>' linkset[0]+='<a href="http://www.codingforums.com">Coding Forums</a>' linkset[0]+='<a href="http://www.cssdrive.com">CSS Drive</a>' linkset[0]+='<a href="http://freewarejava.com">Freewarejava</a>' linkset[1]='<a href="http://msnbc.com">MSNBC</a>' linkset[1]+='<a href="http://cnn.com">CNN</a>' linkset[1]+='<a href="http://news.bbc.co.uk">BBC News</a>' linkset[1]+='<a href="http://www.washingtonpost.com">Washington Post</a>' ////No need to edit beyond here var ie5=document.all && !window.opera var ns6=document.getElementById if (ie5||ns6) document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>') function iecompattest(){ return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body } function showmenu(e, which, optWidth){ if (!document.all&&!document.getElementById) return clearhidemenu() menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu") menuobj.innerHTML=which menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth menuobj.contentwidth=menuobj.offsetWidth menuobj.contentheight=menuobj.offsetHeight eventX=ie5? event.clientX : e.clientX eventY=ie5? event.clientY : e.clientY //Find out how close the mouse is to the corner of the window var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY //if the horizontal distance isn't enough to accomodate the width of the context menu if (rightedge<menuobj.contentwidth) //move the horizontal position of the menu to the left by it's width menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px" else //position the horizontal position of the menu where the mouse was clicked menuobj.style.left=ie5? iecompattest().sc</x-turndown>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups