Cutting Edge: Add a shortcut menu for the ASP.net control (2)

Source: Internet
Author: User
Cutting Edge: Add a shortcut menu for the ASP.net control (2) English original: Adding a context menu to ASP.net Controls
Author: Dino Esposito
Translation: Liu Ruicai
Source code: CuttingEdge0502.exe Programming Interface
Our ContextMenu control inherits from WebControl and executes the INamingContainer interface
public class Contextmenu:webcontrol, INamingContainer
Figure A control's member details, as follows:
Property Description AutoHide Flag automatically hides shortcut menus when a user moves the mouse out of the control area Boundcontrols returns a collection of controls that use the shortcut menu cellpadding Returns or sets the number of pixels around each menu item Contextmenuitems Returns a collection of menu items Rollovercolor Returns or sets the Color method description that is highlighted when the mouse crosses the menu item getescreference returns the Javascrip code used to hide the shortcut menu in the page when the user presses the ESC key Getmenureference Returns a section of JavaScript code that is associated with the HTML element corresponding to the shortcut menu. Getonclickreference returns the code that hides the shortcut menu when the user clicks outside the menu area. Event description ItemCommand When the user clicks on a shortcut menu item into the excitation.
The key property is the Contextmenuitmes collection property, which contains a collection of objects of the Contextmenuitem type, each representing a menu item. The source code of the Contextmenuitem class is as follows:
[TypeConverter (typeof (Expandableobjectconverter))]
public class Contextmenuitem
{
Public Contextmenuitem () {}
Public Contextmenuitem (string text, String commandName)
{
_text = text;
_commandname = CommandName;
}
private string _text;
private string _commandname;
private string _tooltip;
public string Text
{
get {return _text;}
set {_text = value;}
}
public string CommandName
{
get {return _commandname;}
set {_commandname = value;}
}
Public String Tooltip

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.