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

RadNumericTextBox - OnKeyPress is too early

3 Answers 163 Views
Input
This is a migrated thread and some comments may be shown as answers.
Kevin Schneider
Top achievements
Rank 1
Kevin Schneider asked on 05 Jun 2008, 08:29 PM
I have a situation where I need to have a numeric textbox hide/show a division on the page based on whether or not it is empty.  I can't do it onblur / onvaluechanged since it needs to be real-time while they are typing.

I can't use onkeypress either since it is too early and I can't use isEmpty() to validate that the textbox is empty or not.

What client event is available for this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 06 Jun 2008, 07:34 AM
Hello Kevin,


You can use the onkeyup event handler. The onkeyup event occurs when a keyboard key is released.

The following code example demonstrates how to achieve your goal:

       <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <div> 
            <script type="text/javascript"
            function keyup() 
            { 
                var radTextBox = $find("RadTextBox1"); 
                if (!radTextBox.get_textBoxValue()) 
                { 
                    Sys.Debug.trace("Empty!"); 
                } 
                else 
                { 
                    Sys.Debug.trace("Not Empty!") 
                } 
                 
            } 
            </script> 
                     
            <telerik:RadTextBox onkeyup="keyup()" ID="RadTextBox1" runat="server"
            </telerik:RadTextBox> 
             
            <textarea id='TraceConsole' rows="10" cols="50" title="TraceConsole"
            </textarea>             
        </div> 



Kind regards,
Plamen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jrit
Top achievements
Rank 1
answered on 01 Oct 2009, 06:02 PM
I have the same question, but I'm in an up to date version of AJAX controls. The solution proposed works the same as OnKeyPress, so is not effective.
0
Dimo
Telerik team
answered on 02 Oct 2009, 07:55 AM
Hi Jarrett,

I tested the above code with the latest version of RadControls and it worked as expected. Please send us a sample page.

Kind regards,
Dimo
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.
Tags
Input
Asked by
Kevin Schneider
Top achievements
Rank 1
Answers by
Missing User
jrit
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or