我在 ASP.Net C# 中的项目正在编译和运行良好,除非我尝试加载一个特定的页面,该页面上有一个 Ajax Control Toolkit HTMLEditorExtender。我得到一个 Key cannot be null page 错误。我尝试删除 htmleditorextender 并放置一个 asynchfileupload 控件,以确保 scriptmanager 正常工作,并且页面正常运行并且上传控件正常工作。所以它是专门针对 htmleditorextender 的。这是我的代码:
<asp:TextBox ID="txtMailMsgContent" TextMode="MultiLine" runat="server"/>
<cc1:HtmlEditorExtender ID="HTMLEditorExtender" runat="server"
TargetControlID="txtMailMsgContent">
<Toolbar>
<cc1:Undo />
<cc1:Redo />
<cc1:Bold />
<cc1:Italic />
<cc1:Underline />
<cc1:StrikeThrough />
<cc1:Subscript />
<cc1:Superscript />
<cc1:JustifyLeft />
<cc1:JustifyCenter />
<cc1:JustifyRight />
<cc1:JustifyFull />
<cc1:InsertOrderedList />
<cc1:InsertUnorderedList />
<cc1:CreateLink />
<cc1:UnLink />
<cc1:RemoveFormat />
<cc1:SelectAll />
<cc1:UnSelect />
<cc1:Delete />
<cc1:Cut />
<cc1:Copy />
<cc1:Paste />
<cc1:BackgroundColorSelector />
<cc1:ForeColorSelector />
<cc1:FontNameSelector />
<cc1:FontSizeSelector />
<cc1:Indent />
<cc1:Outdent />
<cc1:InsertHorizontalRule />
<cc1:HorizontalSeparator />
</Toolbar>
</cc1:HtmlEditorExtender>
在页面错误上显示错误的行是这一行:
<cc1:HtmlEditorExtender ID="HTMLEditorExtender" runat="server" TargetControlID="txtMailMsgContent">
这是堆栈跟踪:
[ArgumentNullException: Key cannot be null.
Parameter name: key]
System.Collections.Hashtable.get_Item(Object key) +9355627
AjaxControlToolkit.Sanitizer.Sanitizer.Initialize() +163
AjaxControlToolkit.HtmlEditorExtender..ctor() +54
ASP.mail_emailmessage_aspx.__BuildControlHTMLEditorExtender() in c:\Inetpub\wwwroot\Mail\EMailMessage.aspx:111
ASP.mail_emailmessage_aspx.__BuildControlformMailMessage() in c:\Inetpub\wwwroot\Mail\EMailMessage.aspx:84
ASP.mail_emailmessage_aspx.__BuildControlTree(mail_emailmessage_aspx __ctrl) in c:\Inetpub\wwwroot\Mail\EMailMessage.aspx:1
ASP.mail_emailmessage_aspx.FrameworkInitialize() in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\26676eb7\92c7e946\App_Web_kemmoois.0.cs:0
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +54
System.Web.UI.Page.ProcessRequest() +78
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.mail_emailmessage_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\26676eb7\92c7e946\App_Web_kemmoois.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
任何帮助将不胜感激。我试过用谷歌搜索这个错误,但找不到似乎有效的解决方案。