RadNumeric TextBox

4 posts, 0 answers
  1. alex
    alex avatar
    3 posts
    Member since:
    Apr 2009

    Posted 20 Apr 2009 Link to this post

    Hello , i have one RadNumerictextbox in my aspx page , i sent value to it with javascript  function , it shows value in page , but when i click a buttonin page , i cant access value in code behind. it returns ' ' .  why ? what should i do ?
    <script language="javascript">
            function checkedd() {
                var txt2 = document.getElementById('RadNumericTextBox1_text');
                txt2.value = '987';
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server" >
                            <ClientEvents OnLoad="checkedd" />

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Apr 2009 Link to this post

    Hi Alex,

    Since you are using RadControls for ASP.NET Ajax, use the $find() method for getting the client side object of RadNumericTextBox. The document.getElementById will only return a client side reference to its input area DOM element. Try out the following code.

    <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server" >   
                    <ClientEvents OnLoad="checkedd" />   

    <script language="javascript" type="text/javascript">    
    function checkedd()    
        var numericInput = $find("<%= RadNumericTextBox1.ClientID %>");    

    protected void Button2_Click(object sender, EventArgs e)    
    Here you can find more information:
    Client-Side Basics
    RadNumericTextBox Client Object

  3. alex
    alex avatar
    3 posts
    Member since:
    Apr 2009

    Posted 20 Apr 2009 Link to this post

    hello, it works but when i put the  <script language="javascript" type="text/javascript"> in form tag  i have other java script code on <head></head> and i want to use in there not in form tag . what should i do ?
  4. Dimo
    Dimo avatar
    8471 posts

    Posted 22 Apr 2009 Link to this post

    Hello Alex,

    You can place the Javascript function provided by Shinu anywhere on the page that you prefer. However, if it is in the <head>, you must wrap the <script> tag with a <telerik:RadCodeBlock>, otherwise you will get a server error due to the code block.

         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

               <script type="text/javascript">

                // ....................



    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top