2012-04-03 74 views
-1

如何使用像Excel工作表这样的GridView来输入记录?与Excel工作表类似,使用向上/向下箭头键在行中向上/向下移动。GridView在ASP.NET C中插入一行记录#

我需要插入25行以上的单行记录(比如说学生的标记),这些记录由用户根据他们的注册号码输入。我使用<ItemTemplate>TextBox es,但没有发现如此灵活地输入学生的分数。

请帮助我,如果有任何其他方式来做这样的任务。

回答

0

使用向上/向下箭头键在行中执行向上/向下移动使用此URL:Navigating through text input fields using arrow keys and return,它带有代码。

<script type="text/javascript"> 
    $(document).ready(function(){ 
     // get only input tags with class data-entry 
     textboxes = $("input.data-entry"); 
     // now we check to see which browser is being used 
     if ($.browser.mozilla) { 
      $(textboxes).keypress (checkForAction); 
      } 
     else { 
      $(textboxes).keydown (checkForAction); 
     } 
    }); 

function checkForAction (event) { 
     if (event.keyCode == 13 || 40) { 
     currentBoxNumber = textboxes.index(this); 
      if (textboxes[currentBoxNumber + 1] != null) { 
       nextBox = textboxes[currentBoxNumber + 1] 
       nextBox.focus(); 
       nextBox.select(); 
       event.preventDefault(); 
       return false; 
      } 
     } 
    } 
</script>