Hi,
I am having major problems with the RadEditor control.
What makes this particularly troublesome is that it works in IE11
but not Chrome.
I have a RadEditor which is embedded within an asp:ListView control (see below) whic in turn, is embedded into ans ascx user control.
The general idea is that the code behind hides and shows different controls in the ListView rows according to the configuration of a property panel.
When the user makes a selection on the page, the user control is made visible and the asp:ListView below is updated with a new DataBind().
<asp:ListView ID="lveProperties" runat="server"
OnItemDataBound="lveProperties_ItemDataBound">
<ItemTemplate>
<asp:Panel ID="pnlProperty" runat="server">
<div class="row">
<asp:Literal ID="litBannerSpacer1"
runat="server" Text="<br />"
Visible="false"></asp:Literal>
<div class="<%=col1Width%>
coursenames">
<asp:Label ID="lblPropertyName"
runat="server"></asp:Label>
</div>
<div class="<%=col2Width%>
coursenames">
<asp:CheckBox ID="chkCheck"
runat="server" Visible="False"></asp:CheckBox>
<telerik:RadTextBox ID="txtText"
runat="server" Visible="false"></telerik:RadTextBox>
<telerik:RadNumericTextBox ID="txtNumber"
runat="server" Type="Number"
Visible="false"></telerik:RadNumericTextBox>
<telerik:RadComboBox ID="ddlList"
runat="server" Visible="false"
MaxHeight="200"></telerik:RadComboBox>
<telerik:RadDatePicker ID="dpDate"
runat="server" Visible="false"
MinDate="1900/01/01"></telerik:RadDatePicker>
<telerik:RadEditor ID="txtNText"
runat="server" Visible="false" EditModes="Design,Html"
NewLineMode="Br">
<CssFiles>
<telerik:EditorCssFile
Value="/Styles/RadEditorContentAreaStyles.css" />
</CssFiles>
<Languages>
<telerik:SpellCheckerLanguage
Code="en-US" Title="English (US)" />
<telerik:SpellCheckerLanguage
Code="fr-FR" Title="French" />
<telerik:SpellCheckerLanguage
Code="de-DE" Title="German" />
</Languages>
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="Cut" />
<telerik:EditorTool
Name="Copy" ShortCut="CTRL+C" />
<telerik:EditorTool
Name="Paste" ShortCut="CTRL+V" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="Undo" />
<telerik:EditorTool
Name="Redo" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="Bold" />
<telerik:EditorTool
Name="Underline" />
<telerik:EditorTool
Name="Italic" />
<telerik:EditorTool
Name="StrikeThrough" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="JustifyLeft" />
<telerik:EditorTool
Name="JustifyCenter" />
<telerik:EditorTool
Name="JustifyRight" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="InsertOrderedList" />
<telerik:EditorTool
Name="InsertUnorderedList" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="Indent" />
<telerik:EditorTool
Name="Outdent" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="ForeColor" />
<telerik:EditorTool
Name="BackColor" />
<telerik:EditorTool
Name="InsertTable" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="FontName" />
<telerik:EditorTool
Name="RealFontSize" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="AjaxSpellCheck" />
</telerik:EditorToolGroup>
</Tools>
</telerik:RadEditor>
</div>
<asp:Literal ID="litBannerSpacer2"
runat="server" Text="<br /><br />"
Visible="false"></asp:Literal>
</div>
</asp:Panel>
Part of this process sets the RadEditor properties:
txtNText.Visible = true;
txtNText.Width =
Unit.Parse(property.ControlWidth); // eg "100%"
txtNText.Height =
Unit.Parse(property.ControlHeight); // eg "300"
txtNText.MaxTextLength = property.MaxLength;
currentValue = GetZoneProperty(0,
languageId, property.PropertyName);
if (currentValue == "") currentValue =
defaultValue;
txtNText.Content = currentValue;
txtNText.Enabled = enabled;
// Spell checking
txtNText.SpellCheckSettings.AllowAddCustom =
true;
txtNText.SpellCheckSettings.SpellCheckProvider =
SpellCheckProvider.PhoneticProvider;
In IE11, when the RadEditor appears with text populated, it is
correct, however in Chrome, is appears with a single line (see image
attachment).
While debugging the DOM in both IE11 and Chrome, I note that the
iframe is only a few pixels high. IE11 seems to ignore this whereas
Chrome doesn't. I tried various ways, including all of those on the
Telerik forums to 'get' the iframe and set its height, but for some
reason, none of them worked. The Chrome DOM showed this:
<td
id="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNTextCenter"
class="reContentCell" style="height:100%;">
<label
for="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNTextContentHiddenTextarea"
style="display:none;">RadEditor hidden textarea</label>
<textarea
id="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNTextContentHiddenTextarea"
name="ctl00$ContentPlaceHolder$ctlZonePropertyPanel$lveProperties$ctrl1$txtNText"
rows="4" cols="20" style="display:none;">%3cp
style%3d%22text-align%3a center%3b%22%3e%3cspan style%3d%22color%3a
%23002060%3b font-size%3a 18px%3b%22%3eWelcome to the Bushfire
Safety Package
%3c/span%3e%3c/p%3e
%3cp%3e
%3cspan style%3d%22color%3a %23002060%3b%22%3eLorem ipsum
dolor.....</textarea>
<iframe frameborder="0"
src="javascript:'<html></html>';"
id="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNText_contentIframe"
title="Rich text editor with ID
ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNText"
style="width: 100%; height: 35px; margin: 0px; padding:
0px;">Your browser does not support inline frames or is currently
configured not to display inline frames.</iframe>
</td>
My RadEditor control is called txtNText so quite how the name has been changed to ...textNTextCenter I don't know.
Even using document.getElementById on ''ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNText_contentIframe"
did not find the iframe - how can this be ? All the sample solutions eg:
var editorIframe = $get(editorClientID).getElementsByTagName('iframe')[0];
editorIframe.style.height = '100%';
$('#' + editorClientID).setSize('100%','300px');
Failed to find the iframe.
How can I fix this please ?
Better still, can we have a JavaScript API added to the RadEditor which can be called which just 'works' and fixes this ?
Thankyou
PS: Why does pasting into this editor cut all my lines in half and why does it insert a blank line between every line ? This is a nuisance!