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

RadnumericTextbox OnValueChanging

3 Answers 126 Views
Input
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 20 May 2015, 10:22 PM

Hello

Simple setup ; I have two RadnumericTextboxes with spinbuttons enabled.

Is it possible to have the second Textbox reflect the first when I change the value using the arrowkeys ?

I can only get it to update when i leave the first control, I need it to correspond  "live" .



I appreciate any help to the matter.

 

Mark

3 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 22 May 2015, 08:18 AM
An example to clarify:


    <form id="form1" runat="server">
   
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>       
            <asp:ScriptReference Assembly="Telerik.Web.UI" 
                Name="Telerik.Web.UI.Common.Core.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" 
                Name="Telerik.Web.UI.Common.jQuery.js">
            </asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" 
                Name="Telerik.Web.UI.Common.jQueryInclude.js">
            </asp:ScriptReference>                   
        </Scripts>  
        </telerik:RadScriptManager>


    <script type="text/javascript">


        function chg1(sender, args) {

            var tb2 = $find("RadNumericTextBox2");
            tb2.set_value(args.get_newValue());           
            
          }
       
    </script>
    

<telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" ClientEvents-OnValueChanging="chg1"  IncrementSettings-InterceptArrowKeys="true"   ShowSpinButtons="true"   IncrementSettings-Step="1">   
</telerik:RadNumericTextBox>

<telerik:RadNumericTextBox ID="RadNumericTextBox2" ClientIDMode="Static" runat="server" >
</telerik:RadNumericTextBox>

</form>
0
Accepted
Maria Ilieva
Telerik team
answered on 25 May 2015, 02:23 PM
Hi Mark,

Try subscribing to the OnKeyPress client event and apply the approach below:

<script type="text/javascript">
                function keyPress(sender, args) {
                    setTimeout(
                        function () {
                            $find("num2").set_value(sender._getParsedTextBoxValue());
                        });
                }
            </script>
            <telerik:RadNumericTextBox runat="server" ID="num1">
                <ClientEvents OnKeyPress="keyPress" />
            </telerik:RadNumericTextBox>
            <telerik:RadNumericTextBox runat="server" ID="num2"></telerik:RadNumericTextBox>


Regards,
Maria Ilieva
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 26 May 2015, 03:03 PM

Thank you

I'll go the keypress way.


regards

 Mark

Tags
Input
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or