When loaded dynamically in a placeholder, the control is not rendered properly.
It works well without the updatePanel
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Always">
<ContentTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim txtRichText As New TextBox
txtRichText.TextMode = TextBoxMode.MultiLine
txtRichText.Columns = 23
txtRichText.Rows = 20
txtRichText.Width = New WebControls.Unit(100, UnitType.Percentage)
txtRichText.ID = "txtRichText"
txtRichText.Width = 700
txtRichText.Height = 150
Dim txtRichTextEditor As New AjaxControlToolkit.HtmlEditorExtender
txtRichTextEditor.ID = "HtmlEditorExtender"
txtRichTextEditor.TargetControlID = "txtRichText"
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Copy())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Cut())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Paste())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Undo())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Redo())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Bold())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Italic())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Underline())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.StrikeThrough())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyCenter())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyFull())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyLeft())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyRight())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Indent())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Outdent())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.InsertOrderedList())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.InsertUnorderedList())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.SelectAll())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.UnSelect())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.ForeColorSelector())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.BackgroundColorSelector())
PlaceHolder1.Controls.Add(txtRichText)
PlaceHolder1.Controls.Add(txtRichTextEditor)
End Sub
Comments: This is NOT solved. setting EnablePartialRendering to false is NOT a good solution and defeats the purpose of UpdatePanel. In my testing the extender does work dynamically loaded in UpdatePanel if it is loaded before the first ajax postback, but it doesn't render the toolbar icons if you add it during an ajax postback. I only tried this extender because the ajaxeditor doesn't work in medium trust hosting which has been along standing problem that has not been fixed for oever 1 year. So this extender was recommended as a replacement that will work in medium trust but this problem prevents it from really solving the problem or working as a replacement. http://ajaxcontroltoolkit.codeplex.com/workitem/26727 Please fix this and fix the medium trust issue in ajaxeditor
It works well without the updatePanel
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Always">
<ContentTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim txtRichText As New TextBox
txtRichText.TextMode = TextBoxMode.MultiLine
txtRichText.Columns = 23
txtRichText.Rows = 20
txtRichText.Width = New WebControls.Unit(100, UnitType.Percentage)
txtRichText.ID = "txtRichText"
txtRichText.Width = 700
txtRichText.Height = 150
Dim txtRichTextEditor As New AjaxControlToolkit.HtmlEditorExtender
txtRichTextEditor.ID = "HtmlEditorExtender"
txtRichTextEditor.TargetControlID = "txtRichText"
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Copy())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Cut())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Paste())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Undo())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Redo())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Bold())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Italic())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Underline())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.StrikeThrough())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyCenter())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyFull())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyLeft())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.JustifyRight())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Indent())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.Outdent())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.InsertOrderedList())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.InsertUnorderedList())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.SelectAll())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.UnSelect())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.HorizontalSeparator())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.ForeColorSelector())
txtRichTextEditor.Toolbar.Add(New AjaxControlToolkit.BackgroundColorSelector())
PlaceHolder1.Controls.Add(txtRichText)
PlaceHolder1.Controls.Add(txtRichTextEditor)
End Sub
Comments: This is NOT solved. setting EnablePartialRendering to false is NOT a good solution and defeats the purpose of UpdatePanel. In my testing the extender does work dynamically loaded in UpdatePanel if it is loaded before the first ajax postback, but it doesn't render the toolbar icons if you add it during an ajax postback. I only tried this extender because the ajaxeditor doesn't work in medium trust hosting which has been along standing problem that has not been fixed for oever 1 year. So this extender was recommended as a replacement that will work in medium trust but this problem prevents it from really solving the problem or working as a replacement. http://ajaxcontroltoolkit.codeplex.com/workitem/26727 Please fix this and fix the medium trust issue in ajaxeditor