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

Possible RadTextbox bug

1 Answer 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 29 Aug 2012, 01:40 AM
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;
                MakeDirty();
            }
            catch (err) {
            }
        }
          
        function TitleDivChanged() {
            try {
                TitleText=document.getElementById('<%= DivTitle.ClientID %>').innerHTML;
                document.getElementById('<%= txtTitle_WorkingDeal.ClientID %>').value = TitleText;
                MakeDirty();
            }
            catch (err) {
            }
        }
 
 
 
 
 <telerik:RadTextBox ID="txtTitle_WorkingDeal" runat="server"  Width="350" EmptyMessage="Deal Title"
                                               MaxLength="100" Rows="1"
                                              SelectionOnFocus="SelectAll" Text="" ValidationGroup="WorkingDeal"
                                              Wrap="False"
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>

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 29 Aug 2012, 10:35 AM
Hello,

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:
http://www.telerik.com/help/aspnet-ajax/input-client-side-basics.html

All the best,
Vasil
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.
Tags
General Discussions
Asked by
Bill
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or