I am trying to set the Html of the Editor control through the onclick event of a label control using javascript. When I call the .setHtml() method on the control, it throws a runtime error:
Microsoft JScript runtime error: Object doesn't support this property or method
The below javascript returns a reference to the Editor1 object, but the setHtml method does not appear in the list of Methods. I must be missing something, what am I doing wrong here?
My c# , javascript and aspx markup are shown below:
Code: C#
ui_lbl_Html.Attributes.Add("onclick", "javascript:GetContentForEditor(this.id)");
Code: JavaScript
function GetContentForEditor(labelid) {
var html = document.getElementById(labelid).innerHTML;
// the below $get() resolves to: 'ctl00_ContentPlaceHolder1_DialogEditor_ctl00_Editor1'
var Editor1 = $get('<%= Editor1.ClientID %>');
Editor1.setHtml(html);
}
Code: HTML/ASPX
<eo:Dialog ID="DialogEditor"
runat="server"
Width="620px"
Height="450px"
HeaderHtml="Message Editor"
AllowResize="True"
ControlSkinID="None"
ResizeImageUrl="00020014"
RestoreButtonUrl="00070103"
CloseButtonUrl="00070101"
ShadowColor="Gray"
ShadowDepth="3"
BackShadeColor="Gray"
BackShadeOpacity="55"
BorderColor="Black"
BorderStyle="Solid"
BorderWidth="1px"
CancelButton="ui_btn_CancelLibrarianMessage">
<ContentTemplate>
<eo:Editor ID="Editor1"
ToolBarSet="Full"
runat="server"
Width="600px"
Height="350px"
BackColor="White"
BorderColor="#DDDDDD"
BorderStyle="Solid"
BorderWidth="1px"
Html=""
ColorPickerID="ColorPicker1"
FileExplorerDialogID="FileExplorerDialog1"
FileExplorerUrl="FileExplorer.aspx"
SpellCheckerID="SpellChecker1">
<FooterStyle CssText="border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px; padding-left: 2px; padding-bottom: 2px; border-left: gray 1px solid; padding-top: 2px; border-bottom: gray 1px solid; background-color: #fafafa"></FooterStyle>
<TabButtonStyles>
<SelectedStyle CssText="border-right: #335ea8 1px solid; padding-right: 6px; border-top: #335ea8 1px solid; padding-left: 6px; font-size: 12px; padding-bottom: 2px; border-left: #335ea8 1px solid; padding-top: 2px; border-bottom: #335ea8 1px solid; font-family: tahoma; background-color: white"></SelectedStyle>
<NormalStyle CssText="border-right: #335ea8 1px; padding-right: 7px; border-top: #335ea8 1px; padding-left: 7px; font-size: 12px; padding-bottom: 3px; border-left: #335ea8 1px; padding-top: 3px; border-bottom: #335ea8 1px; font-family: tahoma; background-color: white"></NormalStyle>
<HoverStyle CssText="border-right: #335ea8 1px solid; padding-right: 6px; border-top: #335ea8 1px solid; padding-left: 6px; font-size: 12px; padding-bottom: 2px; border-left: #335ea8 1px solid; padding-top: 2px; border-bottom: #335ea8 1px solid; font-family: tahoma; background-color: #c2cfe5"></HoverStyle>
</TabButtonStyles>
</eo:Editor>
<eo:ColorPicker
ID="ColorPicker1"
runat="server"
DesignOptions-BackColor="White"
ControlSkinID="None"
WebColorOnly="true">
<PopupStyle CssText="border-right: #999999 1px solid; border-top: #999999 1px solid; font-size: 10pt; border-left: #999999 1px solid; color: #0751b8; border-bottom: #999999 1px solid; font-family: arial; background-color: white" />
<TextBoxStyle CssText="border-right: #7f9db9 1px solid; border-top: #7f9db9 1px solid; border-left: #7f9db9 1px solid; border-bottom: #7f9db9 1px solid" />
</eo:ColorPicker>
<eo:SpellChecker id="SpellChecker1" runat="server" DialogID="SpellCheckerDialog1"></eo:SpellChecker>
<eo:SpellCheckerDialog id="SpellCheckerDialog1" Width="320px" Height="216px" runat="server" ControlSkinID="None"
CloseButtonUrl="00070301" BackColor="#ECE9D8" HeaderHtml="Spell Checker">
<FooterStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></FooterStyleActive>
<HeaderStyleActive CssText="padding-right: 3px; padding-left: 8px; font-weight: bold; font-size: 10pt; background-image: url(00020113); padding-bottom: 3px; color: white; padding-top: 0px; font-family: 'trebuchet ms';"></HeaderStyleActive>
<ContentStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></ContentStyleActive>
<BorderImages BottomBorder="00020112" RightBorder="00020111" TopRightCornerBottom="00020106" TopLeftCornerRight="00020102"
TopRightCorner="00020104" LeftBorder="00020110" TopLeftCorner="00020101" BottomRightCorner="00020108"
TopLeftCornerBottom="00020103" BottomLeftCorner="00020107" TopRightCornerLeft="00020105" TopBorder="00020109"></BorderImages>
</eo:SpellCheckerDialog>
<br /><br /><center>
<asp:Button ID="ui_btn_Update" runat="server" Text=" Save " OnClick="ui_btn_Update_Command" />
<asp:Button ID="ui_btn_CancelLibrarianMessage" runat="server" Text=" Cancel " OnClientClick="eo_GetObject('DialogEditor').close();" />
</center><br /><br />
</ContentTemplate>
<HeaderStyleActive CssClass="DialogHeader" />
<FooterStyleActive CssClass="DialogFooter" />
<ContentStyleActive CssClass="DialogContent" />
</eo:Dialog>