This is a migrated thread and some comments may be shown as answers.

[Solved] PageUp and PageDown Keys in Grid

0 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin Mason
Top achievements
Rank 1
Kevin Mason asked on 11 Sep 2009, 02:29 PM
Telerik support kindly provided me with this client side code for supporting PageUp and PageDown key presses
for paging after the Grid has focus.  It works for the MasterTableView level.

Perhaps one of the forum members could make a server side equivalent function in C# or VB.

  <%--Handle PageUp and PageDown key presses --%>  
  <script type="text/javascript">  
    var shouldFocus = false;  
    function gridCreated(sender,args) {  
      $addHandler(sender.get_element(),"keydown",Function.createDelegate(sender,keydownHandler));  
      if(shouldFocus){  
        sender.get_element().focus();  
        shouldFocus = false;}  
      }  
      function keydownHandler(args) {  
        if(args.keyCode==33 && this.get_masterTableView().get_currentPageIndex() > 0) {                      
          this.get_masterTableView().page("prev");  
          shouldFocus = true;}  
        else if(args.keyCode==34 ) {  
          this.get_masterTableView().page("next");  
          shouldFocus = true;}                  
      }  
  </script>  
 
 
<telerik: RadGrid ID = RadGrid1 ETC.>        
      <ClientSettings AllowKeyboardNavigation="true">  
        <Selecting AllowRowSelect="true" /> 
        <KeyboardNavigationSettings EnableKeyboardShortcuts="true" AllowActiveRowCycle="true" /> 
        <ClientEvents OnGridCreated="gridCreated" /> 
      </ClientSettings> 
Other Grid code
</telerik:RadGrid>  

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Kevin Mason
Top achievements
Rank 1
Share this question
or