SharePoint Experts, Information Architects, Expert Witness

We provide consulting in a broad array of business and technology from architecture to design to deployment of global systems with a focus on surfacing data in the enterprise. Specialists in Microsoft, we are a premier provider of SharePoint Expertise (including 2016 and Office 365). We also provide Expert Witness/Legal Expert in eDiscovery, source discovery, patent infringement, piracy and more! We also have established SICG DLDS s.a. - our counterpart in Costa Rica that specializes in water systems (http://www.crwatersolutions.com) - Contact me direct: david_sterling@sterling-consulting.com or call 704-873-8846 x704.

Search This Blog

Friday, October 3, 2008

JScript Error using SharePoint HtmlEditor Control

Just one of those "had the problem" and know others will...

When using the HtmlEditor in a web part, you may find that you start receiving JScript errors even though you a) may not have rendered the control and b) the code seems to execute fine all the way through the Render Event.

The problem is that the Control requires anchoring to the physical control on the page; if you define it in the OnLoad or CreateChildControls methods but DO NOT render the control, this situation will occur.

To get around this, you must render the control and Hide it using a Div as in:


writer.Write("
");
CreateHeaderEditorControl.RenderControl(writer);
writer.Write("
");

NOTE: Do not use Visible=false; the control is not rendered and you will get the same error.