locked
Ajax HtmlEditorExtender not showing property in Updatepanel RRS feed

  • Question

  • User-1352156089 posted

    Hi All,

    I am using asp.net webforms (targetFramework="4.5.1") and I have just added ajaxcontroltoolkit 15.1 and this is working fine.

    However, I am experiencing problems with the HtmlEditorExtender when inside my updatepanel which is not property showing: all buttons are grey without icons  and the textarea is just not visible.

    I know this is a question that was asked thousands of times but I could only find a workaround in order to make the Ajax HtmlEditorExtender work and show properly when inside an updatepanel. The control doesn't load some of its resources when it is not set to render on the first pageLoad. In other words, if the control is in a second view of a MultiView control, or if it should Load somehow after a post back.

    This is the code I am using:

    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:TextBox ID="txtcontDescription" runat="server" CssClass="txtcontenttxtarea" TextMode="multiline" Columns="100" Rows="15"  Text='<%# Eval("ContinentDescription")%>'></asp:TextBox>
    <cc1:HtmlEditorExtender ID="HtmlEditorfortxtcontDescriptionx" runat="server" ClientIDMode="Inherit" TargetControlID="txtcontDescription" EnableSanitization="false">
    <Toolbar>
                 <cc1:Undo/>
                 <cc1:Redo/>
                 <cc1:Bold/>
                 <cc1:Italic/>
                 <cc1:Underline/>
    <cc1:InsertOrderedList/>
                 <cc1:InsertUnorderedList/>
                 <cc1:CreateLink/>
                 <cc1:UnLink/>
                 <cc1:RemoveFormat/>
                 <cc1:Cut/>
                 <cc1:Copy/>
                 <cc1:Paste/>
        </Toolbar>
    </cc1:HtmlEditorExtender>

    The workaround is, as per http://ajaxcontroltoolkit.codeplex.com/workitem/27181, 

    1. Add a Panel control somewhere at the beginning of your page, out of the UpdatePanel.
    2. Add a TextBox with an HtmlEditorExtender in the Panel
    3. Set the Visible property of the Panel control to False

    Do you have any other more elegant solution to this problem?

    Thanks

    Thursday, May 7, 2015 11:58 AM

Answers

  • User-1352156089 posted

    I guess there is no other way so far.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 11, 2015 8:45 AM

All replies

  • User-1352156089 posted

    I guess there is no other way so far.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 11, 2015 8:45 AM
  • User1104055534 posted

    hi claudio7810,

    Thank you post here.

    Please try to use ContentTemplate of UpdatePanel like below code:

    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
    
    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
    
    <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <fieldset>
                    <asp:TextBox ID="TextBox1" runat="server" Width="600px" Height="400px"></asp:TextBox>
                    <cc1:HtmlEditorExtender ID="TextBox1_HtmlEditorExtender" runat="server" TargetControlID="TextBox1">
                    </cc1:HtmlEditorExtender>
                    <asp:Button runat="server" Text="Click Me"/>
                </fieldset>
            </ContentTemplate>
        </asp:UpdatePanel>
        
    </asp:Content>

    For more information please refer to following link:

    Best Regards,

    Monday, May 18, 2015 6:35 AM