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

OnCommand fired on Enter key press in outside control

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 02 Mar 2012, 08:19 PM
I have textbox that directly has nothing to do with radgrid on the same page.
Textbox has this:
$('#" + filterControl.ClientID + @"').live('keydown', function(event) {
                                                if (event.keyCode && event.keyCode == '13') {
                                                    return jsApplyFilterAction" + ParameterSetHolder.Group + @"();
                                                }
                                                else {
                                                    return true;
                                                }
                                            });
jsApplyFilterAction**** - method, that calls webservice for filling the grid and making some other things.

For some strange reason when I press Enter being inside this textbox, after executing mentioned method, jsApplyFilterAction, that is ok,

_OnCommand grid event is fired! And command name there is 'Sort'!

As a result, I get unpredictable results and double call of webservice.

I tried to disable _OnCommand event firing with different grid properties, but vain.

How to get rid of this OnCommand triggering and why, after all, it's triggered?

UPDATE: it happens in Firefox, not in IE(9). Chrome is also ok.

1 Answer, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 03 Mar 2012, 07:40 PM
Nobody knows?

Hmm...

I have noticed that when I "come" to _Command method from textbox enter keypress - SortExpression is either "" or " ASC" or " DESC".
So, the only thing I could do was checking for SortExpression validity: if its lowercased trim is "asc" or "desc" - I just do not call webservice.
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Share this question
or