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

Pageup/down problem

1 Answer 37 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jagan
Top achievements
Rank 1
jagan asked on 20 May 2011, 09:54 AM
When we have a value in a textbox inside radgridview,which is currently has focus and if we press pagedown, the cursor first comes to end of the text and once again pressing pagedown then only the page down event occurs. How to make the pagedown event happen with single press inside radgridview?

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 20 May 2011, 04:01 PM
Hi jagan,

The behavior that you are referencing is the expected one. The Textbox, that is currently in edit mode handles the KeyDown event and that is why the RadGridView does not as it is already handled.  

In order to receive the handled events, you could subscribe for a routed KeyDown event in the application itself. Handling events like this is not very good approach though.

For example you could implement your scenario by subscribing and handling the event like this:

this.AddHandler(FrameworkElement.KeyDownEvent, new KeyEventHandler(OnKeyDown), true);
private void OnKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
       {
           if (e.Key == System.Windows.Input.Key.PageDown)
           {
               this.clubsGrid.CurrentCellInfo = new GridViewCellInfo(clubsGrid.Items[3], clubsGrid.Columns[0]);
               this.clubsGrid.CurrentCell.IsInEditMode = true;
              // your logic here
           }
       }

The general idea of routed events in Silverlight and WPF is as follows - they climb up the visual tree so that in the end the control that handles the event gets hit whenever that event fires for any control below it in the visual tree. Handling LeftMouseButtonUp on your GridView or even UserControl is fine. You just have to check if the element in which the event originates is the one you need and only then take action.

I hope that this suggestion is helpful for you.

Regards,
Didie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
jagan
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or