Cannot get value into RadMaskedTextBox

4 posts, 0 answers
  1. Bill
    Bill avatar
    175 posts
    Member since:
    Apr 2010

    Posted 28 Sep 2010 Link to this post

    I have a RadMaskedTextBox in my html, and cannot place a value in it from a javascript function call. If I change the type of textbox to just a regular asp.net TextBox, the value comes in just fine (33331).

    How can I manipulate either the RadMaskedTextBox or js function to accept the value from the js? Below is my code.

    <telerik:RadMaskedTextBox ID="priInsZip" runat="server" Height="21px" Mask="#####"
                                                                                                                                Width="70px">
                                                                                                                            </telerik:RadMaskedTextBox>


    <js code>

    var priInsZip = document.getElementById("priInsZip");

    priInsZip.value = InsZip;


    </js code>
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Sep 2010 Link to this post

    Hi,

    You need to use the $find() method to get the client side object of the RadMaskedTextBox.
     
            var dInput = $find("<%= priInsZip.ClientID %>");

    Now use get_value() method of client object to get the value.


    Have ea look at the following link to know more about client side methods of RadMaskedTextBox.
    RadMaskedTextBox Client Object



    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bill
    Bill avatar
    175 posts
    Member since:
    Apr 2010

    Posted 29 Sep 2010 Link to this post

    Shinu, I tried your suggested solution, but all I got back after executing the $find method was an empty string. The var Zip just contained an empty string. Here is the js code below:

    var Zip = $find("<%= priInsZip.ClientID %>");
                        var Zip2 = Zip.get_value();

    priInsZip.value = Zip2.value;

    I have the entire script block wrapped in a radcodeblock to take care of the server side tags within the js.

    What am I doing incorrectly?

  5. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 29 Sep 2010 Link to this post

    Hello WIlliam,

    The line where you're setting the value should look like this:

    Zip.set_value(Zip2);

    I hope that helps.
Back to Top