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:
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>