21428

AJAX Html Editor Extender upload image appearing blank

Using AJAX 4 (latest version) I have been working with the html editor extender trying to upload images with text, I have got the Image to upload however it appears blank and when looking at the source, the source of the image is also blank (image below) how do I resolve this upload my selected image? <img src="https://i.stack.imgur.com/aBdDG.png" alt="enter image description here">

Answer1:

Include in HtmlEditorExtender an event handler for the ImageUploadComplete event.

<ajaxToolkit:HtmlEditorExtender OnImageUploadComplete="MyHtmlEditorExtender_ImageUploadComplete" ...

Within the ImageUploadComplete event handler, you need to do two things:

1) Save the uploaded image 2) Provide the URL to the saved image so the image can be displayed within the HtmlEditorExtender

protected void MyHtmlEditorExtender_ImageUploadComplete( object sender, AjaxFileUploadEventArgs e) { // Generate file path string filePath = "~/Images/" + 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); }

Make sure you checked http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/HTMLEditorExtender/HTMLEditorExtender.aspx and http://stephenwalther.com/archive/2012/05/01/ajax-control-toolkit-may-2012-release

Recommend

  • Validate end date should be greater than start date?
  • AjaxToolKit - Extender controls may not be registered before PreRender
  • HTML5 Drag and Drop Issue
  • Jquery ui-sortable - unable to drop tr in empty tbody
  • how to call interface from TouchableWrapper class in android
  • How to determine a long touch on android?
  • XMaskEvent not returning
  • Compare Date values in Entity Framework
  • How to write a Cisco IOS script to run a set of commands at a certain time each day?
  • What are 'batches' and 'steps' in TensorFlow Estimators and how do they differ f
  • Javascript event still firing even when class name doesn't exist
  • Action bar is hidden and that shown instantly after that
  • Drag and drop (replace) in HTML 5
  • Android ScrollView disable Inertial scrolling
  • Save captured video to file in Electron
  • XMLStarlet and RSS
  • 0x800a138f - JavaScript runtime error: Unable to get property 'value' of undefined or null
  • Dragging HTML element , implemented with HammerJS , is jittery on touch device
  • Symfony2 SwiftMailer sendmail transport error
  • Easel.js: Browser compatibility when placing an image within a container and adding mouse interactio
  • Create a string collection from CheckedListBox.CheckedItems using LINQ
  • How to print plain text using Monodevelop and C#?
  • Coloring QSlider for Particular Range [closed]
  • getting remote ip address in connectionless server
  • Problem with Custom TFS Web Service Plugin
  • How can I tell when ANY variable is set to a given value in Lua?
  • Why does Python (with twill) not want to log me in to a Yahoo mail box here?
  • Unable to open the PDF, which was generated using print to pdf code written in C#
  • Adding a Dropdown inside Kendo Grid
  • Is it possible to disable esc/F11 key during full screen mode of webpage, programmatically?
  • How to plot large time series (thousands of administration times/doses of a medication)?
  • Android distinguish between tap and double tap
  • Trying to get generic when generic is not available
  • embed rChart in Markdown
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal