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"> <ItemTemplate> <div><dnn:TextEditor ID="txtHeaderText" runat="server" /></div><br /> </ItemTemplate> </asp:Repeater>
.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
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { }
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 dedicated to the discussion of DNN Platform.
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.