Intersoft WebGrid Documentation
How-to: Validate input (number only) in a cell using OnEditKeyDown
See Also Send comments on this topic.

Glossary Item Box

This walkthrough will show you how to use OnEditKeyDown client side event.

In this topic, you will learn the basic thing on how to validate input (number only) in a cell using OnEditKeyDown.

To validate input (number only) in a cell using OnEditKeyDown

  1. Select WebGrid's instance and press F4.
  2. In Layout Settings, select ClientSideEvents, then set OnEditKeyDown to WebGrid1_OnEditKeyDown.
  3. Write the following function in OnEditKeyDown client side event:

    JavaScript Copy ImageCopy Code
    function WebGrid1_OnEditKeyDown(controlId)
    {
      var WebGrid1 = ISGetObject(controlId); 
      var key = event.keyCode;
      if(key < 96 || key > 105)
      {
       return false;
      }
      else
      {
       return true;
      }
    }
    

  4. Run the project.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.