When I try using the editor extender, I get this error saying the following:
System.InvalidCastException was unhandled by user code
HResult=-2147467262
Message=Unable to cast object of type 'AjaxControlToolkit.HTMLEditor.Editor' to type 'System.Web.UI.WebControls.TextBox'.
Source=AjaxControlToolkit
StackTrace:
at AjaxControlToolkit.HtmlEditorExtender.OnLoad(EventArgs e) in f:\TeamCity\buildAgent\work\80acd78aa4c25314\Server\AjaxControlToolkit\HtmlEditorExtender\HtmlEditorExtender.cs:line 257
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
I really do not understand why this is happening. Here is my source:
<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminPanel.Master" AutoEventWireup="true" CodeBehind="AddPage.aspx.cs" Inherits="BCCS.Admin.AddPage" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %><asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"><style type="text/css"> .auto-style4 { height: 12px; } .auto-style5 { height: 11px; } .auto-style6 { height: 2px; }</style></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server"><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager><asp:Label ID="lblComplete" runat="server"></asp:Label><table ID="tblContentEntry" runat="server"><tr style="vertical-align:top"><td class="auto-style5">Page Name </td><td class="auto-style5"><asp:TextBox ID="txtPageName" runat="server"></asp:TextBox></td></tr><tr style="vertical-align:top"><td class="auto-style6">Parent Page </td><td class="auto-style6"><asp:DropDownList ID="ddlParentPage" runat="server" AppendDataBoundItems="True" DataSourceID="dsParentPageList" DataTextField="CategoryName" DataValueField="ID"><asp:ListItem Selected="True">-- Parent Page --</asp:ListItem><asp:ListItem Value="0">Top Level Page</asp:ListItem></asp:DropDownList><asp:SqlDataSource ID="dsParentPageList" runat="server" ConnectionString="Data Source=***********************" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ID], [CategoryName] FROM [Menu]"></asp:SqlDataSource></td></tr><tr style="vertical-align:top"><td class="auto-style6">Description:</td><td class="auto-style6"><asp:TextBox ID="txtPageDescription" runat="server" Height="16px" Width="767px"></asp:TextBox></td></tr><tr style="vertical-align:top"><td>Content:</td><td><cc1:Editor ID="edtContentEditor" runat="server"
TargetControlID="edtContentEditor"></cc1:Editor><ajaxToolkit:HtmlEditorExtender ID="heeContentEditor" runat="server" TargetControlID="edtContentEditor"><Toolbar> <ajaxToolkit:Undo /><ajaxToolkit:Redo /><ajaxToolkit:Bold /><ajaxToolkit:Italic /><ajaxToolkit:Underline /><ajaxToolkit:StrikeThrough /><ajaxToolkit:Subscript /><ajaxToolkit:Superscript /><ajaxToolkit:JustifyLeft /><ajaxToolkit:JustifyCenter /><ajaxToolkit:JustifyRight /><ajaxToolkit:JustifyFull /><ajaxToolkit:InsertOrderedList /><ajaxToolkit:InsertUnorderedList /><ajaxToolkit:CreateLink /><ajaxToolkit:UnLink /><ajaxToolkit:RemoveFormat /><ajaxToolkit:SelectAll /><ajaxToolkit:UnSelect /><ajaxToolkit:Delete /><ajaxToolkit:Cut /><ajaxToolkit:Copy /><ajaxToolkit:Paste /><ajaxToolkit:BackgroundColorSelector /><ajaxToolkit:ForeColorSelector /><ajaxToolkit:FontNameSelector /><ajaxToolkit:FontSizeSelector /><ajaxToolkit:Indent /><ajaxToolkit:Outdent /><ajaxToolkit:InsertHorizontalRule /><ajaxToolkit:HorizontalSeparator /><ajaxToolkit:InsertImage /></Toolbar></ajaxToolkit:HtmlEditorExtender></td></tr><tr style="vertical-align:top"><td class="auto-style4">Publish:</td><td class="auto-style4"><asp:CheckBox ID="chkPublish" runat="server" /></td></tr><tr style="vertical-align:top"><td colspan="2" style="text-align:center"><asp:Button ID="btnSubmit" runat="server" Text="Add Page"
onclick="btnSubmit_Click"/></td></tr></table></asp:Content>
I hate to say I am stuck but I am. Using ajax toolkit version 4.