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: Oups, not solved at all since EnablePartialRendering="false" deactivate Ajax... Any idea?
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: Oups, not solved at all since EnablePartialRendering="false" deactivate Ajax... Any idea?