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

Selection with SHIFT Doesn't work as expected (Strange Behaviour)

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mallory
Top achievements
Rank 1
Mallory asked on 12 Apr 2010, 12:37 PM
Hi everyone

Since the RadGrid doesn't automatically postback when a user selects multiple items from the RadGrid using the SHIFT key, you have to do it manually. I've implemented this behaviour by subscribing to the the RadGrid's client-side OnRowSelected event. All I do in the mentioned event handler is calling the RadAjaxManager's ajaxRequest method (also on the client) to trigger the postback:
function RowSelected(sender, args) { 
    var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>"); 
    ajaxManager.ajaxRequest('StrgShiftCombinationPressed'); 

Should be that simple, but I have the following issue: Everytime I select multiple items with the SHIFT key, one item (actually, the last one) doesn't show up as selected after the postback. For example, if I select 4 items with the SHIFT key, first all the selected items are selected, but after the postback (and after the loading panel disappears), only 3 elements are selected.

To see what's going on on the server-side, I added an event handler for the RadGrid's server-side OnSelectedIndexChanged event. In the event handler, the grid.SelectedItems collection counts also one element less than selected (e.g. 4 items are selected with the SHIFT key, but grid.SelectedItems.Count evaluates to only 3). Also, if I select only one row with the SHIFT key pressed, the RadAjaxManager's server-side OnAjaxRequest is fired, but not the RadGrid's OnSelectedIndexChanged event (I have to mention, that I added the following AjaxSetting to the RadAjaxManager: radAjaxManager.AjaxManager.AjaxSettings.AddAjaxSetting(((MyMaster)this.Master).ajaxManager,  radGrid) ). When I select 2 items with the SHIFT key pressed, the OnSelectedIndexChanged is fired!

This issue has been bothering me for quite a long time, and I would be very thankful if somebody could successfully point me where I'm doing something wrong.

Thanks in advance.

Greetings,
Mallory

2 Answers, 1 is accepted

Sort by
0
Mallory
Top achievements
Rank 1
answered on 13 Apr 2010, 03:01 PM
I hope that somebody can help me solving this very annoying issue.

Although EnablePostBackOnRowClick is enabled since ever, not even the ItemCommand event fires when clicking on exactly one row with the SHIFT key pressed. 
0
Pavlina
Telerik team
answered on 15 Apr 2010, 11:54 AM
Hello Mallory,

Please have in mind that after calling the ajaxRequest method on RowSelected client-side event you should not set EnablePostBackOnRowClick. Also OnSelectedIndexChanged event is fired when you click select command button in grid.

However, it will be best if you open a formal support ticket and send us a runnable page/project where the issue can be reproduced - we will inspect it and will provide you with further information.

Kind regards,
Pavlina
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
Grid
Asked by
Mallory
Top achievements
Rank 1
Answers by
Mallory
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or