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

Enter Key in TextBox and LoadPanel

4 Answers 92 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Dominik
Top achievements
Rank 1
Dominik asked on 25 Jan 2012, 01:57 PM
Helo,
On simple page I have TextBox.
I want to associate pressing Enter key in TextBox with LoadPanel and Panel.
When I associate TextBox in AjaxManager, nothing is happend.
Can I please for help ?
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
 
        <telerik:AjaxSetting AjaxControlID="TextBox_autor_nazwisko">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Panel1"
                    LoadingPanelID="RadAjaxLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="RadNotification1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
 
    </AjaxSettings>
</telerik:RadAjaxManager>


4 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 25 Jan 2012, 04:28 PM
Hello Dominik,

Set AutoPostBack="true" for your TextBox, this will change it's behavior to make PostBack.

Kind regards,
Vasil
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
Dominik
Top achievements
Rank 1
answered on 26 Jan 2012, 09:52 AM
Thank You Vasil,

Yes, when I set AutoPostBack=true then LoadPanel work with Enter key.
But it work also, when I move cursor to another TextBox on the Form.
I'm looking for how to invoke LoadPanel ONLY after Enter key, but not after focus change.
If the only way for working Enter key on TextBox with LoadPanel is enable AutoPostback, how I can disable PostBack when TextBox change focus to another TextBox on the Form ?
0
Vasil
Telerik team
answered on 26 Jan 2012, 10:05 AM
Dominik,

Then you could handle the client OnKeyPress event of the RadTextBox and change the AutoPostback depending on the keyCode of the last pressed key.
<script type="text/javascript">
  function ChangePostBackSetting(sender, eventArgs)
  {
    sender.set_autoPostBack(13 == eventArgs.get_keyCode());
  }
</script>
<telerik:RadTextBox runat="server" ID="RadTextBox6">
  <ClientEvents OnKeyPress="ChangePostBackSetting" />
</telerik:RadTextBox>


Kind regards,
Vasil
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
Dominik
Top achievements
Rank 1
answered on 26 Jan 2012, 10:29 AM
Thank You Vasil !

solution working. thread can be closed.

sorry for trivial questions :)

Tags
Ajax
Asked by
Dominik
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Dominik
Top achievements
Rank 1
Share this question
or