简体   繁体   English

阻止在GridView的只读列中使用箭头键

[英]Block use of arrow keys in read only columns in gridview

I am using VS 2005,asp.net,c#.net. 我正在使用VS 2005,asp.net,c#.net。 I have a grid view which is in an update panel. 我在更新面板中有一个网格视图。 Is it possible to block the moving of arrow keys to readonly columns in gridview 是否可以阻止将箭头键移动到gridview中的只读列

Thanks in advance George. 预先感谢乔治。

Write a JavaScript function that will be called on when the event KeyDown fires. 编写一个JavaScript函数,该事件将在事件KeyDown触发时被调用。 The check, if the keycode (member of eventArgs) equals the code of an arrow key. 检查键码(eventArgs的成员)是否等于箭头键的代码。 If so, skip the column or just return, if you want to do nothing. 如果是这样,请跳过该列或仅返回即可,如果您什么都不愿做。

edit: 编辑:

something like this: 像这样的东西:

function skipKeyPress(event){
  // 37 = left arrow key
  // 38 = up arrow key
  // 39 = right arrow key
  // 40 = down arrow key
  if(event.keyCode >= 37 && event.keyCode <=40)
    return;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM