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

Page Up and Page Down not working

6 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rashmi
Top achievements
Rank 1
Rashmi asked on 23 Jan 2012, 02:18 PM
Hi,
  I have a radgrid with static headers and scrolling(no paging). When I set AllowKeyboardNavigation=true, 'Page Up','Page Down','Home' and 'End' keys stopped working. But when it set to false, these keys work properly. I have set EnableKeyboardShortcuts=false. I wish to have these keys working.

Thanks,
Mahesh

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Jan 2012, 06:15 AM
Hello Mahesh,

I tried the same scenario which worked as expected. Here is the sample code.
aspx:
<telerik:RadGrid  ID="grid" runat="server"  DataSourceID="SqlDataSource1" AutoGenerateColumns="false">
 <MasterTableView TableLayout="Fixed">
   <Columns>
     . . .
   </Columns>
  <ClientSettings AllowKeyboardNavigation="true" Selecting-AllowRowSelect="true">
  <Scrolling AllowScroll="true" UseStaticHeaders="true" />
 </MasterTableView>
</telerik:RadGrid>

-Shinu.
0
Radoslav
Telerik team
answered on 25 Jan 2012, 08:39 AM
Hello Mahesh,

When the keyboard navigation is enabled into the RadGrid the [PAGE UP]/[PAGE DOWN] keys are used for navigating between RadGrid pages - [Page UP] moves to the next page, [PAGE DOWN] moves to the previous page. The [Home] and [End] keys are disabled. This behavior is by design. To achieve the desired functionality you need to disable the grid KeyboardNavigation or to implement your own logic on these keys (You could handle the OnKeyPress client side event and apply your custom logic there).

I hope this helps.

Kind regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Rashmi
Top achievements
Rank 1
answered on 25 Jan 2012, 09:39 AM
Hi Radoslav,
  Any thoughts on implementing page up and page down? Page up should scroll grid up and page down should down. Is there any client side API exposed for this?
Regards,
Mahesh
0
Radoslav
Telerik team
answered on 27 Jan 2012, 12:48 PM
Hi Mahesh,

I am sending you a simple example which demonstrates how to achieve the desired functionality. Please check it out and let me know if it helps you.

Looking forward for your reply.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Rashmi
Top achievements
Rank 1
answered on 27 Jan 2012, 02:42 PM
Hi Radoslav,
 Very much thanks for sample code. It works fine, but I want that functionality with Home and End.
 keyPress event is not fired for these buttons, it is fired correctly for other buttons.
 I want grid to scroll so that items that are currently in view should be scrolled up and next set of items should be visible(no paging though) and also when height of grid is not fixed(so the no. of items currently in view.) How to acheive this?

Thanks in advance,
Mahesh
0
Radoslav
Telerik team
answered on 31 Jan 2012, 10:36 AM
Hello Mahesh,

Could you please try changing the code snippet as following and let me know if it helps you:
function OnKeyPress(sender, eventArgs) {
            if (eventArgs.get_keyCode() == 49) {
                var scrollArea = document.getElementById(sender.get_element().id + "_GridData");
                scrollArea.scrollTop = 100000;
            }
            if (eventArgs.get_keyCode() == 55) {
                var scrollArea = document.getElementById(sender.get_element().id + "_GridData");
                scrollArea.scrollTop = 0;
            }
        }

Regarding he second requirement:
 I want grid to scroll so that items that are currently in view should be scrolled up and next set of items should be visible(no paging though) and also when height of grid is not fixed(so the no. of items currently in view.) :

You need to calculate a height of a single row and multiply it by rows number. Then when a Home or End keys are pressed you could to change the scrollTop with the result.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Rashmi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Radoslav
Telerik team
Rashmi
Top achievements
Rank 1
Share this question
or