Hi everyone
on DNN 9.12.0 I am using TextEditor (CKEditor) inside a Repeater. Inside Repeater_ItemDataBound I try to set a value to the TextEditor. The following error occurs: 'txtHeaderText.Text' threw an exception of type 'System.NullReferenceException'.
I am using the following:
.ascx <%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx"%> <asp:Repeater ID="rptHeaderFooterText" runat="server" OnItemCommand="HeaderFooterText_ItemCommand" OnItemDataBound="HeaderFooterText_ItemDataBound"> <dnn:TextEditor ID="txtHeaderText" runat="server" />
.ascx.cs protected void HeaderFooterText_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { var txtHeaderText = e.Item.FindControl("txtHeaderText") as TextEditor; if (txtHeaderText != null) { txtHeaderText.Text = "some value"; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
Any suggestions? Thank you.
Martin
Unfortunately the same error message and Editor's content still empty
BTW: Everything works fine as long as TextEditor is outside of a Repeater.
I'm not sure the text editor is meant to be contained in a repeater like that. It would need to have some updates applied to support it, I think. Especially some event handling. If you wish to have a text editor in a repeated like that, you may be better off using a purely client-side HTML editor. :)
These Forums are for the discussion of the open source CMS DNN platform and ecosystem.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.