vb.net AJAX - TagPrefix 未注册
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20470838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
AJAX - TagPrefix is not registered
提问by indofraiser
I have looked at code on Unknown server tag "ajaxToolkit:HtmlEditorExtender"but am still stuck so would appreciate a second pair of eyes.
我已经查看了未知服务器标签“ajaxToolkit:HtmlEditorExtender”上的代码,但仍然卡住了,所以希望能看到第二双眼睛。
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!)
我想要做的是,在提交时,将 HTML 代码传递给一个字符串并保存它。(此时我只是想让 HTML 编辑器工作!)
Error: HTML EditorExtender. -- This control cannot be display because its TagPrefix is not registered in this Web Form
错误:HTML EditorExtender。-- 此控件无法显示,因为它的 TagPrefix 未在此 Web 窗体中注册
'######
'######
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.
AJAX 新手。
I have
我有
AjaxControlToolkit.dll in the bin folder as well as ajaxcontroltoolkit.pdb
bin文件夹中的AjaxControlToolkit.dll以及ajaxcontroltoolkit.pdb
Whole code below:
完整代码如下:
Default.aspx
默认.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
默认.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>
回答by Josh Darnell
You have this in your Default.aspx file:
你的 Default.aspx 文件中有这个:
<%@ 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:
请注意您如何将“asp”的 tagPrefix 分配给 AJAXControlToolkit 控件。您需要将其更改为:
<%@ 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).
那时,您可能可以从 web.config 中删除该行(您不需要在两个地方都需要它)。

