2013-12-09 100 views
2

我已經看過Unknown server tag "ajaxToolkit:HtmlEditorExtender"上的代碼,但我仍然堅持以便欣賞第二雙眼睛。AJAX - TagPrefix沒有註冊

然後,我想要做的是,在提交時,將HTML代碼傳遞給一個字符串並保存。 (我只是試圖讓HTML編輯器在這一點上工作!)

錯誤:HTML EditorExtender。 - 這種控制無法顯示,因爲它的TagPrefix未在該Web窗體註冊

「######

我曾嘗試加入

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

但隨後網頁出現無效以及。

AJAX上的新手。

AjaxControlToolkit.dll bin文件夾以及下面ajaxcontroltoolkit.pdb

整個代碼:

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> 

回答

3

這個有你的Default.aspx文件:

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

注意到你如何分配 「ASP」 的的TagPrefix到AJAXControlToolkit控制。你需要改變的是這樣的:

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

在這一點上,你也許可以從web.config中刪除行(你不需要它在這兩個地方)。