Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Input > Set Radnumeric textbox value through Javascript
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Set Radnumeric textbox value through Javascript

Feed from this thread
  • Posted on Feb 1, 2011 (permalink)

    Hello,

    I am using telerik.web.UI - 2010.1.0.519.40.

    I am not able to set  value of radnumeric textbox through javascript

    Can you please help me out to resolved my issue?

    Thanks,

  • Posted on Feb 1, 2011 (permalink)

    Hello Kapilesh,

    You can achieve the scenario by using the client method set_value()like below.
    aspx:
    telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" >
            <ClientEvents OnLoad="SetValue" />
    </telerik:RadNumericTextBox>

    javascript:
    function SetValue(sender, args)   
           {   
               var input1 = $find('<%= RadNumericTextBox1.ClientID %>');
               input1.set_value(8);         
           }

    Thanks,
    Shinu.

  • Posted on Feb 2, 2011 (permalink)

    Dear Shinu,
    Thanks for quick reply.
    As per below sentence we get null for input1

    var
    input1 = $find('<%= RadNumericTextBox1.ClientID %>');


    Thanks

  • Posted on Feb 2, 2011 (permalink)

    Hello Kapilesh,

    I am not quite sure about the issue. One suggestion is to use the sender for getting reference to the control.
    function SetValue(sender, args)  //setting value in onLoad
           {  
               var input1 = sender;
               input1.set_value(8);        
           }

    If you want to set the value to the RadNumericTextBox on any other event like client-side ButtonClick, then one suggestion is to attach the OnLoad event to the RadNumericTextBox and save the sender value in a global variable. Now in the onclick event you can access the control by accessing the global variable.

    Thanks,
    Shinu.

  • Posted on Feb 3, 2011 (permalink)

    HI Shinu,

    Thnaks for reply,

    i have already write <ClientEvents OnLoad="SetValue" />.
    but get null value for  $find('<%= RadNumericTextBox1.ClientID %>');

    - kalpesh

  • Maria Ilieva Maria Ilieva admin's avatar

    Posted on Feb 9, 2011 (permalink)

    Hi Kalpesh,

    Please find attached a sample application which shows the correct working for the required functionality. Test it on your side and let me know what the difference in your case is. Also please ensure that you are pointing the correct input ID in the java script function.


    Regards,

    Maria Ilieva
    the Telerik team

     


    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
    Attached files

  • Posted on Feb 10, 2011 (permalink)

    Hi Support team,

    Actually I have to set value of textbox on onblur of other control, not on load of Textbox.

    If I am write $find('<%= RadNumericTextBox1.ClientID %>') it return null value.

    If write like document.getElementById('<%= RadNumericTextBox1.ClientID %>')  it return object but that not support method set_value(8) and return error  “Microsoft JScript runtime error: Object doesn't support this property or method”.


    Thanks for support
    -Kalpesh

  • Posted on Feb 11, 2011 (permalink)

    Hi Kalpesh,


    Give a try with following approach and see whether it works.

    Mark-up:
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server">
    <ClientEvents OnBlur="SetValue" />
    </telerik:RadNumericTextBox>
    <telerik:RadNumericTextBox ID="RadNumericTextBox2" runat="server">
    <ClientEvents OnLoad="OnLoad" />
    </telerik:RadNumericTextBox>


    Client code:
    <script type="text/javascript">
            var textBox;
           function OnLoad(sender, args) {
             textBox = sender;
            }
     
        function SetValue(sender, args) {
            var input1 = textBox;
            input1.set_value(8);
        }
     
    </script>


    Are you placed the textbox control inside any other container control? Could you elaborate the scenario if this does not help?


    -Shinu.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Input > Set Radnumeric textbox value through Javascript