Intersoft WebGrid Documentation
OnRowContextMenu Property
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > ClientEvents Class : OnRowContextMenu Property






Specifies the client side (JavaScript) function that will be invoked when row context menu is about to be displayed.

Syntax

Visual Basic (Declaration) 
<ISNet.EventParameterAttribute("controlId, rowType, rowElement, menuObject")>
<DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when row context menu is about to be displayed.")>
<NotifyParentPropertyAttribute(True)>
<ISNet.Serialization.XmlSerializableAttribute()>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")>
<DefaultValueAttribute()>
<ISNet.Serialization.BinarySerializableAttribute()>
Public Property OnRowContextMenu As String
Visual Basic (Usage)Copy Code
Dim instance As ClientEvents
Dim value As String
 
instance.OnRowContextMenu = value
 
value = instance.OnRowContextMenu
C# 
[ISNet.EventParameterAttribute("controlId, rowType, rowElement, menuObject")]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when row context menu is about to be displayed.")]
[NotifyParentPropertyAttribute(true)]
[ISNet.Serialization.XmlSerializableAttribute()]
[EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")]
[DefaultValueAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
public string OnRowContextMenu {get; set;}
Delphi 
public read-write property OnRowContextMenu: String; 
JScript 
ISNet.EventParameterAttribute("controlId, rowType, rowElement, menuObject")
DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when row context menu is about to be displayed.")
NotifyParentPropertyAttribute()
ISNet.Serialization.XmlSerializableAttribute()
EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")
DefaultValueAttribute()
ISNet.Serialization.BinarySerializableAttribute()
public function get,set OnRowContextMenu : String
Managed Extensions for C++ 
[ISNet.EventParameterAttribute("controlId, rowType, rowElement, menuObject")]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when row context menu is about to be displayed.")]
[NotifyParentPropertyAttribute(true)]
[ISNet.Serialization.XmlSerializableAttribute()]
[EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")]
[DefaultValueAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
public: __property string* get_OnRowContextMenu();
public: __property void set_OnRowContextMenu( 
   string* value
);
C++/CLI 
[ISNet.EventParameterAttribute("controlId, rowType, rowElement, menuObject")]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when row context menu is about to be displayed.")]
[NotifyParentPropertyAttribute(true)]
[ISNet.Serialization.XmlSerializableAttribute()]
[EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="ISNet.WebUI.Design.ClientSideEventEditor, ISNet.WebUI.Design")]
[DefaultValueAttribute()]
[ISNet.Serialization.BinarySerializableAttribute()]
public:
property String^ OnRowContextMenu {
   String^ get();
   void set (    String^ value);
}

Property Value

Returns return value.

Example

 

The following is the example on how to assign a javascript function to the client side event.
C#Copy Code
WebGrid1.LayoutSettings.ClientSideEvents.OnRowContextMenu = "WebGrid1_OnRowContextMenu";
The following is the example of the javascript function that is assigned in above event:
JScriptCopy Code
function WebGrid1_OnRowContextMenu(controlId, rowType, rowElement, menuObject) 
{ 
     var WebGrid1 = ISGetObject(controlId); 

     alert("The city of selected row is " + rowElement.cells[2].innerText); 

     return true; 
}

Remarks

The user-defined function should only contain the name of the function. For example, "HandleEvent". This event allow developers to add their own custom menu to the row context menu.

The function can be defined in either inline or linked JavaScript files and can accept following parameters:

gridId

The ID of the grid calling the function.

rowType

The type of the row being clicked.

rowElement

The HTML row element.

menuObject

The context menu object.

Note that you should include the return value of your function. Returning a true value means that default behavior will be processed. Otherwise, the default behavior will be skipped.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Reference

ClientEvents Class
ClientEvents Members

Tasks

How-to: Display Delete menu item in WebGrid's context menu when in a specific row using OnRowContextMenu
How-to: Add/Remove a menu in WebGrid's context menu
How-to: Add a SubMenu in WebGrid's context menu
How-to: Use WebContextMenu as WebGrid's context menu

Concepts

Context Menus
Events

©2012 Intersoft Solutions Corp. All Rights Reserved.