Possible RadTextbox bug

2 posts, 0 answers
  1. Bill
    Bill avatar
    42 posts
    Member since:
    Feb 2011

    Posted 28 Aug 2012 Link to this post

    This behaviour happens with RadTextbox but not with a standard textbox so may be a bug:

    I have a RadTextbox and a Div (Runat=Server) on a usercontrol
    The Div has ContentEditable=true set.
    When you type in the RadTextbox, the div text updates (Script)When you type in the Div, the RadTextbox text updates.

    The problem is if you change the text in the div (RadTextbox text changes as it should), when you click in the RadTextbox, the text resets back to its proginal value.

    Heres the basic script:

      function TitleChanged(ObjSource, objDestination) {
            try {
            document.getElementById('<%= DivTitle.ClientID %>').innerHTML = ObjSource.value;
                    TitleText = ObjSource.value;
                catch (err) {
            function TitleDivChanged() {
                try {
                    TitleText=document.getElementById('<%= DivTitle.ClientID %>').innerHTML;
                    document.getElementById('<%= txtTitle_WorkingDeal.ClientID %>').value = TitleText;
                catch (err) {
     <telerik:RadTextBox ID="txtTitle_WorkingDeal" runat="server"  Width="350" EmptyMessage="Deal Title"
                                                   MaxLength="100" Rows="1"
                                                  SelectionOnFocus="SelectAll" Text="" ValidationGroup="WorkingDeal"
    OnKeyup="TitleChanged(this, 'divTitle')"></telerik:RadTextBox>


    <div ID="divTitle" onkeyup="TitleDivChanged()" CONTENTEDITABLE="true" runat="server" class="Title" style="color: #000000">TITLE</div>

    This Works:
          <asp:TextBox ID="txtTitle_WorkingDeal" runat="server"  Width="350"
                                            MaxLength="100" Rows="1"
                                               OnKeyup="TitleChanged(this, 'divTitle')"></asp:TextBox>
  2. Vasil
    Vasil avatar
    1642 posts

    Posted 29 Aug 2012 Link to this post


    Instead of:
    document.getElementById('<%= txtTitle_WorkingDeal.ClientID %>').value = TitleText;
    You should use:
    $find('<%= txtTitle_WorkingDeal.ClientID %>').set_value(TitleText);

    Additionally see this help topic about the public JavaScript API of RadInput control:

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top