RadNumericTextbox Onblur

10 posts, 1 answers
  1. Brindavan
    Brindavan avatar
    12 posts
    Member since:
    Feb 2009

    Posted 11 Feb 2009 Link to this post

    Hi,

    I have 2 radnumerictextboxes and on tabbing out of each of them I need to do some javascript calculations and populate a third radtextbox. Onblur of the first 2 fields I am able to call the javascript function and calculate. But the result is not getting populated in 3rd box till I place cursor in 3rd textbox and this is not what I want.

    Any pointers in this regard will help.

    Regards,
    Brindavan
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Feb 2009 Link to this post

    Hi Brindavan,

    I tried the scenario and its working fine for me (Product Version 2008.03.1314.20). I am not sure about what is happening at your side and I am getting the value populated in the third RadTextBox on focusout of the NumericTextBoxes. Take a look at the client side code which I tried to achieve this functionality and check whether it’s working fine for you.

    JavaScript:

    <script type="text/javascript"
    function OnBlur() 
        var Input1 = $find("<%= RadNumericTextBox1.ClientID %>"); 
        var value1= Input1.get_value(); 
        var result = value1*2; 
        var Input3 = $find("<%= RadTextBox1.ClientID %>"); 
        Input3.set_value(result);    
    function OnBlur1() 
        var Input2 = $find("<%= RadNumericTextBox2.ClientID %>"); 
        var value2= Input2.get_value(); 
        var result = value2*2; 
        var Input3 = $find("<%= RadTextBox1.ClientID %>"); 
        Input3.set_value(result); 
    </script> 

    ASPX:
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server"
            <ClientEvents OnBlur="OnBlur" /> 
    </telerik:RadNumericTextBox> 
    <telerik:RadNumericTextBox ID="RadNumericTextBox2" Runat="server"
            <ClientEvents OnBlur="OnBlur1" /> 
    </telerik:RadNumericTextBox> 
    <telerik:RadTextBox ID="RadTextBox1" runat="server"
    </telerik:RadTextBox> 

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brindavan
    Brindavan avatar
    12 posts
    Member since:
    Feb 2009

    Posted 12 Feb 2009 Link to this post

    Hi Shinu,

    Thanks for the code.
    I have numerous places on the screen where I have to do such calculations and I was trying to write a generic javascript function for all. In the code you provided above I need to call one function for each control and it is likely that I can have more than 20 such sets of controls on the screen.

    Also I cannot gain access to control's client id in javascript directly. The controls are placed inside a telerik grid editform template.

    Please suggest.

    Brindavan
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Feb 2009 Link to this post

    Hi Brindavan,

    Go through the following codelibrary submission which expains how to access template controls on the client side.
    Accessing server controls in a grid template on the client

    Thanks
    Shinu



  6. Zeke Sheppard
    Zeke Sheppard avatar
    32 posts
    Member since:
    Oct 2009

    Posted 05 Feb 2010 Link to this post

    I have tried using this sample on a user control but the event does not appear to be firing. What needs to occur to allow this to work?

    The change to the control are listed here. There is a RadScriptManager on the container page.

    <

     

    script type="text/javascript">

    function

     

    OnBlurNetWeight() {

     

    window.alert(

    'Here');

     

     

    </

     

    script>

     

     

     

     

     

    <telerik:RadNumericTextBox ID="rntNetKilos" Width="85px" Runat="server" >

     

     

    <ClientEvents OnBlur="OnBlurNetWeight" />

     

     

    </telerik:RadNumericTextBox>

     

  7. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 11 Feb 2010 Link to this post

    Hi Zeke,

    Based on the supplied information, it is hard to determine why the event is not fired.
    To properly trace the issue, you can open a formal support ticket, and send us a small project, demonstrating your setup. We will debug it locally, and get back to you with more information on the matter.

    Greetings,
    Yavor
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  8. umesh
    umesh avatar
    2 posts
    Member since:
    Sep 2012

    Posted 03 Feb 2013 Link to this post

    I have Same problem , when used the Rad numeric textbox control as a web user control. the radnumeric textbox not fired in case of  client-event as well as server side event. i tried both client as well as server event of OnvalueChanged event but its not fired.
  9. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 04 Feb 2013 Link to this post

    Hello umesh,

    Try out this example and let us know how it goes:
    <script type="text/javascript">
        function ValueChangedHandler(sender, args)
        {
            //place your code here
        }
    </script>
    <telerik:RadNumericTextBox runat="server">
        <ClientEvents OnValueChanged="ValueChangedHandler" />
    </telerik:RadNumericTextBox>


    Greetings,
    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.
  10. umesh
    umesh avatar
    2 posts
    Member since:
    Sep 2012

    Posted 04 Feb 2013 Link to this post

    Thanks Vasil for replying,
    but Not working this also. I am using RadNumericTextbox in Webuser Control and control used in Web form. all is working well. but no textchanged event fired even at server side or client side.
  11. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 06 Feb 2013 Link to this post

    Hi Umesh,

    This code should work with no problem, it is actually used in one of demos. I have also tested it before writing it here, and can confirm that it works. The server side event also is fired as expected here.

    Make sure the script debugging in your browser is enabled, and that you don't get any JavaScript exceptions from your code. If you get some exception, the JS execution will stop and the event will not fire.

    If this does not helps, try to insulate the problem in sample runnable web page and send its code to us for further debugging.

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017