Add a shortcut menu for the ASP. NET control (1)

Source: Internet
Author: User
Tags versions
Add a shortcut menu for the ASP. NET control (1)
Although shortcut menus are very common elements in desktop applications. server-based technologies such as NET are not well described, so shortcut menus are not very common in Web applications. To use a shortcut menu, the browser must highly support DHTML and rich event modes, such as Microsoft® Internet Explorer 5.0 and later, or Netscape 6.0. However, although the object modes of various browsers have the same functions, their names are different, this requires us to convert objects and events from one mode to another.
Here, we create an ASP. NET shortcut menu for the object mode of Internet Explorer. Then, I will modify the function to support other browsers. The code supports ASP. NET 1.x. you can also compile it in ASP. NET2.0 Beta1 using Outline of
ContextMenu Control shortcut menu Control overview:
MSDN Liabrary contains several DHTML shortcut menu examples. This feature cannot be implemented. A shortcut menu is a set of tag code at any position on the page. It consists of two parts: the interface and script (associate the UI when you right-click the page). The UI provides a list of clickable elements-menu items-and their respective content text, icon, command name, target url, tooltip, and everything you think is necessary. The shortcut menu interface is part of a page and is a member of the page control tree. (Too many shortcut menus may cause execution problems: ASP.. NET sends more shortcut menus to the browser.) when you right-click an element on the page, a JavaScript code is triggered. This script moves the shortcut menu to the right-click position for display.
The shortcut menu is hidden. The shortcut menu is displayed only when you right-click an element bound to a shortcut menu on the page. The page element receives the script event and a shortcut menu is displayed as a response. The script event depends on the browser and is an OnContexMenu event in Internet Explorer 5.0 and later versions. in Netscape6.0 and later versions, you need to use the OnMouseUp event (in Internet Explorer 5.0 +, you may also use the OnMouseUp event, but you need to write a few more lines of code) in the script that receives the event, obtain the UI code block of the shortcut menu and move it to the position where the shortcut menu is clicked. Set the visibilty attribute of the pop-up panel. When you click a menu item, the page will return and cause server events. For servers, clicking a menu item is no different from clicking a regular button.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.