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






Specifies the client side (JavaScript) function that will be invoked when keypress is detected during editing mode (edit control is in focus).

Syntax

Visual Basic (Declaration) 
<ISNet.Serialization.BinarySerializableAttribute()>
<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")>
<NotifyParentPropertyAttribute(True)>
<ISNet.EventParameterAttribute("controlId")>
<DefaultValueAttribute()>
<ISNet.Serialization.XmlSerializableAttribute()>
<DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when keypress is detected during editing mode (edit control is in focus).")>
Public Property OnEditKeyDown As String
Visual Basic (Usage)Copy Code
Dim instance As ClientEvents
Dim value As String
 
instance.OnEditKeyDown = value
 
value = instance.OnEditKeyDown
C# 
[ISNet.Serialization.BinarySerializableAttribute()]
[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")]
[NotifyParentPropertyAttribute(true)]
[ISNet.EventParameterAttribute("controlId")]
[DefaultValueAttribute()]
[ISNet.Serialization.XmlSerializableAttribute()]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when keypress is detected during editing mode (edit control is in focus).")]
public string OnEditKeyDown {get; set;}
Delphi 
public read-write property OnEditKeyDown: String; 
JScript 
ISNet.Serialization.BinarySerializableAttribute()
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")
NotifyParentPropertyAttribute()
ISNet.EventParameterAttribute("controlId")
DefaultValueAttribute()
ISNet.Serialization.XmlSerializableAttribute()
DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when keypress is detected during editing mode (edit control is in focus).")
public function get,set OnEditKeyDown : String
Managed Extensions for C++ 
[ISNet.Serialization.BinarySerializableAttribute()]
[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")]
[NotifyParentPropertyAttribute(true)]
[ISNet.EventParameterAttribute("controlId")]
[DefaultValueAttribute()]
[ISNet.Serialization.XmlSerializableAttribute()]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when keypress is detected during editing mode (edit control is in focus).")]
public: __property string* get_OnEditKeyDown();
public: __property void set_OnEditKeyDown( 
   string* value
);
C++/CLI 
[ISNet.Serialization.BinarySerializableAttribute()]
[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")]
[NotifyParentPropertyAttribute(true)]
[ISNet.EventParameterAttribute("controlId")]
[DefaultValueAttribute()]
[ISNet.Serialization.XmlSerializableAttribute()]
[DescriptionAttribute("Specifies the client side (JavaScript) function that will be invoked when keypress is detected during editing mode (edit control is in focus).")]
public:
property String^ OnEditKeyDown {
   String^ get();
   void set (    String^ value);
}

Property Value

Returns return value.

Example

 

The example below shows how to configure Enter key to act as Tab key in NewRow section.
C#Copy Code
WebGrid1.LayoutSettings.ClientSideEvents.OnEditKeyDown = "HandleEditKeyDown";
The following is the example of the javascript function that is assigned in above event.
JScriptCopy Code
function HandleEditKeyDown(gridId)
{
    var grid = wg_States[gridId]; 
    var ac = grid.getActiveEditCell(); 
    
    if (ac.rowElement.type == "NewRow")
    {
        if (event.keyCode == 13) // If Enter key is pressed
        event.keyCode = 9; // change it to Tab
    }
    return true; // continue default processing.
}

Remarks

The user-defined function should only contain the name of the function. For example, "HandleEvent".

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.

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.

For more information you can read Walkthrough: Changing "Enter" key behavior and How-to: Reconfigure the "Enter" key functions on EditMode.

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

Walkthrough: Changing "Enter" key behavior
How-to: Reconfigure the "Enter" key functions on EditMode
How-to: Validate input (number only) in a cell using OnEditKeyDown

Concepts

Events

©2012 Intersoft Solutions Corp. All Rights Reserved.