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

Change RadTextBox value via Javascript

1 Answer 354 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 30 May 2008, 08:56 PM
I have the following coding

    <telerik:RadTextBox ID="RadTextBox1" runat="server" EnableEmbeddedSkins="false" BackColor="Red" ForeColor="White" />
 <asp:Button ID="btnTest" runat="server" OnClientClick="populateNTLogin('test');return false;" />
             <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
       <script  type="text/javascript">
       

         function populateNTLogin(arg)
         {
         var textbox = window["<%= RadTextBox1.ClientID %>"];
             textbox.SetValue(arg);
             return false;
         }
        </script>
    </telerik:RadCodeBlock>

On clicking the button, the value is not populated to the textbox. Any idea how to solve this

1 Answer, 1 is accepted

Sort by
0
Accepted
Baatezu
Top achievements
Rank 2
answered on 31 May 2008, 04:39 AM
function populateNTLogin(arg) 
    var textbox = $find('<%= RadTextBox1.ClientID %>'); 
    textbox.set_value(arg); 

I'd try that. I'm not sure that the window[] function is, so that's why I took it out. :)

The proper way to call the set_value is all lower case and with an underscore, as you can see at http://www.telerik.com/help/aspnet-ajax/input_clientsideradtextbox.html.
I took out return false because it seemed irrelevant in the code example you provided.
Tags
General Discussions
Asked by
Raymond
Top achievements
Rank 1
Answers by
Baatezu
Top achievements
Rank 2
Share this question
or