ajaxcontroltoolkit html 编辑器显示图像空白
ajaxcontrol tool kit htmleditor shows blank for image
我正在尝试使用 ajaxcontrol 工具包 htmleditor。下面是我在网上找到的代码
<asp:TextBox ID="txtInstruction" runat="server" Wrap="true" Width="600px" Height="300px" TextMode="MultiLine" />
<ajaxToolkit:HtmlEditorExtender ID="MyHtmlEditorExtender" runat="server" TargetControlID="txtInstruction" DisplaySourceTab="true"
OnImageUploadComplete="MyHtmlEditorExtender_ImageUploadComplete" >
<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>
这是预兆
protected void MyHtmlEditorExtender_ImageUploadComplete(object sender, AjaxFileUploadEventArgs e)
{
// Generate file path
string filePath = "~/tmpImages/" + e.FileName;
// Save uploaded file to the file system
var ajaxFileUpload = (AjaxFileUpload)sender;
ajaxFileUpload.SaveAs(MapPath(filePath));
// Update client with saved image path
e.PostedUrl = Page.ResolveUrl(filePath);
}
每次我点击上传按钮时,我不断收到的错误消息是 "Unable to cast object of type 'UploadRequestProcessor' to type 'AjaxControlToolkit.AjaxFileUpload'."。
我正在从 AJAX Html Editor Extender upload image appearing blank 中获取示例,所以我不确定我缺少什么。如果我使用这行代码
var ajaxFileUpload = (AjaxFileUpload)发件人;
out,它会让我将上传的图像保存到文件夹中,但图像在编辑器中将是空白的。非常感谢任何帮助。非常感谢你的帮助
我正在尝试使用 ajaxcontrol 工具包 htmleditor。下面是我在网上找到的代码
<asp:TextBox ID="txtInstruction" runat="server" Wrap="true" Width="600px" Height="300px" TextMode="MultiLine" />
<ajaxToolkit:HtmlEditorExtender ID="MyHtmlEditorExtender" runat="server" TargetControlID="txtInstruction" DisplaySourceTab="true"
OnImageUploadComplete="MyHtmlEditorExtender_ImageUploadComplete" >
<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>
这是预兆
protected void MyHtmlEditorExtender_ImageUploadComplete(object sender, AjaxFileUploadEventArgs e)
{
// Generate file path
string filePath = "~/tmpImages/" + e.FileName;
// Save uploaded file to the file system
var ajaxFileUpload = (AjaxFileUpload)sender;
ajaxFileUpload.SaveAs(MapPath(filePath));
// Update client with saved image path
e.PostedUrl = Page.ResolveUrl(filePath);
}
每次我点击上传按钮时,我不断收到的错误消息是 "Unable to cast object of type 'UploadRequestProcessor' to type 'AjaxControlToolkit.AjaxFileUpload'."。
我正在从 AJAX Html Editor Extender upload image appearing blank 中获取示例,所以我不确定我缺少什么。如果我使用这行代码 var ajaxFileUpload = (AjaxFileUpload)发件人; out,它会让我将上传的图像保存到文件夹中,但图像在编辑器中将是空白的。非常感谢任何帮助。非常感谢你的帮助