Why has radtextbox no text and asp textbox has some?

2 posts, 0 answers
  1. adi
    adi avatar
    81 posts
    Member since:
    Feb 2007

    Posted 02 Jul 2009 Link to this post

    Hi,

    I have a issue with the radtextbox control. I have some placed inside an usercontrol. On my parent page, I have a button which when clicked call a method in my usercontrol that reads the text properties of the input controls. The property is empty if I use the radtextbox. If I switch to the asp.net version I can use the property values. What I haven't understood?

    Thnx,
    Adi
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jul 2009 Link to this post

    Hi Adi,

    I tried to implement a similar scenario on my end and I was able to get the value of the RadTextBox as shown below.

    ASPX:
     
     <uc1:WebUserControl ID="WebUserControl1" runat="server" /> 
             
            <input id="Button3" type="button" value="GetText"  onclick="GetText();" /> 


    JS:
     
    <script type="text/javascript" > 
     
    function GetText() 
    {  
      var txtbx=document.getElementById("WebUserControl1_RadTextBox1_text"); 
      alert(txtbx.value); 
     
     
    </script> 

    ASCX:
     
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <telerik:RadTextBox ID="RadTextBox1" runat="server"  Text="Hello"
    </telerik:RadTextBox> 


    Thanks
    Shinu.

Back to Top