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

Why does pressing ENTER button close my rad windows???

13 Answers 679 Views
Window
This is a migrated thread and some comments may be shown as answers.
Acadia
Top achievements
Rank 1
Iron
Acadia asked on 01 Mar 2009, 07:02 PM
When I have a rad window open if I click the title bar of the window so that the window itself has the focus, then I hit enter, the window closes.  This is very annoying and I need to stop it from happening, but I can't seem to stop it completely.  I can stop it from happening when the user has the focus on a control on the window's form, but not the rad window itself.

Thanks

13 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 02 Mar 2009, 10:00 AM
Hello Acadia,

You are the first to report such problem and I cannot reproduce it locally. Could you please let me know if you can reproduce the same behavior in any of our online demos?

If you cannot reproduce the problem in the demo pages, please open a support ticket and send us a small sample project where this issue can be observed. We will check it and do our best to help.


Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Acadia
Top achievements
Rank 1
Iron
answered on 02 Mar 2009, 01:28 PM
I was not able to reproduce it on the demo I tried.  What seems to be happening is that my window is open by clicking a link button on my grid.  When the window opens if I don't do anything except hit the enter key, the grid that the window was open from does a post back as though the first button on the first row had been clicked.  If I make the first button invisible it clicks the second button on the grid.  Very strange but I simply can't find a way to stop it.  I've tried everything.  This is also happening with windows opened by buttons outside of the grid (on the main page) except when the window closes nothing happens it just returns to the main page.

It seems to be some kind of focus issue where when the rad window opens, the first object on the control that opened the window maintains the focus and gets clicked when you hit enter.

I suppose I could try putting an empty 1 px label in the very first cell of the grid that opens the window so that nothing happens when I hit enter, but I would think there is a better solution.  This is a big problem because users sometimes accidentally hit the enter key.  I capture the event when they do it once a control on the window has the focus, but I can't prevent it when they first come into the window and accidentally hit enter.

I'll let you know what I find.

Thanks
0
p braunstein
Top achievements
Rank 1
answered on 25 Aug 2009, 10:03 PM
FYI, I'm building an asp.net app and have found that when I force focus to be on a textbox when the window opens (so users can immediately begin entering data without having to click the box), and then blindly hit the <enter> key, the window closes.  When I open a form with NO cursor focus, I can beat on the <enter> key all I want and the form remains open.  This is a real nuisance for me; there are times when you can click or tab to a button and hit <enter> and I DO want the system to do things in the code behind, but other times I just want to ignore the click and leave the screen up.
0
Jakub Gutkowski
Top achievements
Rank 1
answered on 02 Dec 2009, 05:01 PM
I have the same issue with Enter.

by default Enter is refreshing the rad window content (don't know why). If focus is inside the window, enter is closing it by my "cancel" button:

<asp:Button runat="server" ID="btnCancel" Text="Anuluj" Width="120px" OnClientClick="closeDisplayContractors(true); return false;" CausesValidation="false" />

btnCancel is the last element on the page. If I will add a dummy button after btnCancel, the dummy button is called instead of btnCancel.

this is a quite annoying thing as I've got a search text box in that window:
<telerik:RadTextBox runat="server" ID="txtSearchBox" EmptyMessage="(podaj wartość)" Width="100%">
                        <ClientEvents OnKeyPress="shouldSubmitSearch" />                             
                    </telerik:RadTextBox>

This box i taking a OnKeyPress and on enter, should preform search, but instead its still closing a window.
Please help.

Cheers,
   Jakub G
0
Georgi Tunev
Telerik team
answered on 03 Dec 2009, 12:28 PM
Hi guys,

I would suggest to manually remove the focus from the element that called the RadWindow (by using blur()) or as an alternative - to set the focus on the content page. For example you can use the native ASP.NET AJAX pageLoad() function
e.g.
function pageLoad()
{
   $get("<%= TexBox1.ClientID %>").focus();
}



Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jakub Gutkowski
Top achievements
Rank 1
answered on 03 Dec 2009, 03:26 PM
Hi Georgi,

blur() helped with first issue: window is refreshing content on pressing Enter after calling radopen(...).

But still issue with enter exists inside window. I have focus on search text box, when I press enter following code is executed (java script):
function shouldSubmitSearch(sender, args) { 
                if (args.get_keyCode() != 13) { 
                    // character will be added 
                    return true
                } 
 
                submitSearch(); 
                // enter will not be added as character 
                return false
            } 
 
            function submitSearch() { 
                var searchText = $telerik.$('#<%= txtSearchBox.ClientID %>'); 
                var columnField = $find('<%= rcbSearchColumn.ClientID %>'); 
 
                alert(searchText.val()); 
                 
                return false
            } 

and just after alert(searchText.val()), btnCancel event if fired even though the focus is on search box.

Cheers,
   Jakub G
0
Georgi Tunev
Telerik team
answered on 04 Dec 2009, 07:06 AM
Hello Jakub,

To see if the problem is related to the RadWindow control, please replace it with a standard IFRAME and see if the same problem occurs again. If it doesn't, e.g. it is reproducible only when RadWindow is involved, please open a support ticket and send me a sample project so I could investigate further.


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Andreas Rehm
Top achievements
Rank 1
answered on 21 Jan 2010, 07:00 PM
The solution is quite simple: You need a dummy button! Yes - it's not a joke. Just add a button on top of your pane:

<asp:ImageButton ID="DummyButton" runat="server" ImageUrl="~/images/1x1.GIF" onClientClick="return false;" />

You need a 1x1 transparent GIF picture.

This solution is a quick and dirty hack - there is a bug in the event management. The RadPane seems to send events to all RadPanes on the same page. If your event is a Click or PostBack it will fire on the first control. This dummy fires a client event "return false" which does not do a postback.

Regards
0
Joe Parks
Top achievements
Rank 1
answered on 09 Mar 2010, 01:43 AM
The invisible image button did not work for me.
Wrapping a dummy button in a hidden div does work for me:
<div style="display:none"><asp:Button ID="foo" runat="server" OnClientClick="return false;" /></div

This is the same problem described here:
http://www.telerik.com/community/forums/aspnet-ajax/form-decorator/problem-with-radformdecorator-and-login-control.aspx




-Joe Parks


0
Brian
Top achievements
Rank 1
answered on 22 Sep 2010, 09:22 PM
Was there ever an official answer on how to solve this problem?  I am experiencing the same issue where my window will close (and execute the code behind the first button on the screen).  Plus my radwindow will close (and execute the code behind the first button on the screen) if I hit the backspace key while the cursor is in a readonly radtextbox.

Brian
0
Georgi Tunev
Telerik team
answered on 24 Sep 2010, 12:47 PM
Hi Brian,

In general, the problem described here refers to a specific setup, so there is no universal solution that we could implement in our code.
Please open a support ticket and send us a small sample project that reproduces your exact setup so we can check it. Once we receive it, we will do our best to provide you with the most appropriate solution.

Greetings,
Georgi Tunev
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
0
Dru
Top achievements
Rank 1
answered on 14 Jun 2011, 05:13 PM

I just disabled the enter key.  Enter still works in RadEditors that are on the page as well.  This might not be a valid solution for everyone, but in my situation it was. 

 

<form id="form1" runat="server" onkeydown="return DisableEnterSubmit(event.keyCode);">

<script type="text/javascript">       

    function DisableEnterSubmit(key) {
        if (key == 13) {
            return false;
        }
    }

</script>

 

0
Waseem
Top achievements
Rank 1
answered on 11 Oct 2012, 02:43 PM
Some time When you Press enter , Radwindow automatically open and some time when you enter Radwindow automatically close.
I my project . this condition arise, when i did not refresh my parent page, just only refresh one drop down.
When i enter some text in textbox. it refreshes. (simple just disable your enter key).

<script type="text/javascript">
          function DisableEnterSubmit(key) {
              if (key == 13) {
                  return false;
              }
          }
</script>
  <form id="form1" runat="server" onkeydown="return DisableEnterSubmit(event.keyCode);">
  </form>
Tags
Window
Asked by
Acadia
Top achievements
Rank 1
Iron
Answers by
Georgi Tunev
Telerik team
Acadia
Top achievements
Rank 1
Iron
p braunstein
Top achievements
Rank 1
Jakub Gutkowski
Top achievements
Rank 1
Andreas Rehm
Top achievements
Rank 1
Joe Parks
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Dru
Top achievements
Rank 1
Waseem
Top achievements
Rank 1
Share this question
or