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

RadNumericTextbox Onblur

9 Answers 335 Views
Input
This is a migrated thread and some comments may be shown as answers.
Brindavan
Top achievements
Rank 1
Brindavan asked on 12 Feb 2009, 12:58 AM
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

9 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Feb 2009, 06:33 AM

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.
0
Brindavan
Top achievements
Rank 1
answered on 13 Feb 2009, 01:54 AM
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
0
Shinu
Top achievements
Rank 2
answered on 13 Feb 2009, 09:01 AM
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



0
Zeke Sheppard
Top achievements
Rank 1
answered on 05 Feb 2010, 03:25 PM
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>

 

0
Yavor
Telerik team
answered on 11 Feb 2010, 06:13 AM
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.
0
umesh
Top achievements
Rank 1
answered on 04 Feb 2013, 05:19 AM
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.
0
Vasil
Telerik team
answered on 04 Feb 2013, 09:20 AM
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.
0
umesh
Top achievements
Rank 1
answered on 04 Feb 2013, 11:14 AM
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.
0
Vasil
Telerik team
answered on 06 Feb 2013, 03:46 PM
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.
Tags
Input
Asked by
Brindavan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Brindavan
Top achievements
Rank 1
Zeke Sheppard
Top achievements
Rank 1
Yavor
Telerik team
umesh
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or