AJAX - TagPrefix is not registered

18,199

You have this in your Default.aspx file:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" 
    TagPrefix="asp" %>

Notice how you're assigning the tagPrefix of "asp" to the AJAXControlToolkit controls. You need to change that to this:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" 
    TagPrefix="ajaxToolkit" %>

At that point, you can probably remove the line from the web.config (you don't need it in both places).

Share:
18,199
indofraiser
Author by

indofraiser

I am a .NET and SQL developer who loves to get out running or swimming (sometimes cycling) in my free time.

Updated on July 20, 2022

Comments

  • indofraiser
    indofraiser almost 2 years

    I have looked at code on Unknown server tag "ajaxToolkit:HtmlEditorExtender" but am still stuck so would appreciate a second pair of eyes.

    What I want to do is then, on submit, pass the HTML code to a string and save it. (I am only trying to get the HTML Editor to work at this point!)

    Error: HTML EditorExtender. -- This control cannot be display because its TagPrefix is not registered in this Web Form

    '######

    I have tried adding

    <pages>
                  <controls>
                      <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
                  </controls>
              </pages>
    

    But then pages comes up as invalid as well.

    Newbie on AJAX.

    I have

    AjaxControlToolkit.dll in the bin folder as well as ajaxcontroltoolkit.pdb

    Whole code below:

    Default.aspx

    <%@ Page Title="Default" Language="VB"  AutoEventWireup="false"  CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    
    <%@ Register  
        Assembly="AjaxControlToolkit"  
        Namespace="AjaxControlToolkit.HTMLEditor"  
        TagPrefix="HTMLEditor" %>  
    
         <%@ Register
    Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="HTMLEditor" %>
    
    <asp:TextBox runat="server"
            ID="txtBox1" 
            TextMode="MultiLine" 
            Columns="50" 
            Rows="10" 
            Text="Hello <b>world!</b>" />
    
    
     <ajaxToolkit:HtmlEditorExtender ID="replyBody_HtmlEditorExtender" runat="server" Enabled="True" OnImageUploadComplete="saveFile"  ClientIDMode="AutoID" EnableSanitization="true"  TargetControlID="replyBody">
    
        <p>Test page shows</p>
    

    Default.aspx.vb

    Partial Class _Default
        Inherits System.Web.UI.Page
    
    End Class
    

    Web.Config

    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
      </connectionStrings>
      <system.web>
          <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
    
    
              <pages>
                  <controls>
                      <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
                  </controls>
              </pages>
    
    
              <assemblies>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
        </compilation>
        <authentication mode="Forms">
          <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
        </authentication>
        <membership>
          <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
          </providers>
        </membership>
        <profile>
          <providers>
            <clear/>
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
          </providers>
        </profile>
        <roleManager enabled="false">
          <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
            <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
          </providers>
        </roleManager>
      </system.web>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    
    </configuration>