RadnumericTextbox OnValueChanging

4 posts, 1 answers
  1. Mark
    Mark avatar
    36 posts
    Member since:
    Mar 2014

    Posted 20 May 2015 Link to this post

    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

  2. Mark
    Mark avatar
    36 posts
    Member since:
    Mar 2014

    Posted 22 May 2015 Link to this post

    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>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 May 2015 Link to this post

    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
  5. Mark
    Mark avatar
    36 posts
    Member since:
    Mar 2014

    Posted 26 May 2015 in reply to Maria Ilieva Link to this post

    Thank you

    I'll go the keypress way.


    regards

     Mark

Back to Top