Пример #1
0
 protected virtual void OnKeyPress(GridKeyPressEventArgs e)
 {
     if (KeyPress != null)
     {
         KeyPress(this, e);
     }
 }
Пример #2
0
        private void el_KeyDown(jQueryEvent e)
        {
            if (!enabled)
            {
                return;
            }

            GridKeyPressEventArgs ev = new GridKeyPressEventArgs();

            ev.KeyCode = e.Which;
            OnKeyPress(ev);
            if (ev.PreventDefault)
            {
                e.PreventDefault();
                return;
            }

            switch (e.Which)
            {
            case 38:
                // key up
                if (NumRows > 0 && selectedRowIndex > 0)
                {
                    SelectedRowIndex = (selectedRowIndex == -1 ? 0 : SelectedRowIndex - 1);
                }
                e.PreventDefault();
                break;

            case 40:
                // key down
                if (NumRows > 0 && selectedRowIndex < NumRows - 1)
                {
                    SelectedRowIndex = (SelectedRowIndex == -1 ? 0 : SelectedRowIndex + 1);
                }
                e.PreventDefault();
                break;
            }
        }