11 Answers, 1 is accepted
In order to reload the content of RadWindow every time it is shown you have to configure its ReloadOnShow and ShowContentDuringLoad properties like follows:
<
telerik:RadWindow
ID
=
"RadWindow1"
runat
=
"server"
NavigateUrl
=
"ImageEditor.aspx"
Width
=
"900"
Height
=
"700"
ReloadOnShow
=
"true"
ShowContentDuringLoad
=
"false"
></
telerik:RadWindow
>
I hope this helps.
Regards,
Vessy
Telerik

Thanks but the issue is I am loading the RadWindow as follows:
imbDog.Attributes.Add("onclick", "openRadWindow('" + Constants.DIALOG_DOGPHOTO + "?pic=y&dog=" + d.ID.ToString() + "'); return false;");
Even if I go to a totally different page and click to open this particular rad window for a another client in our system that same photo is loaded into the ImageEditor. It has to be caching it or something. That seems to be the real issue. How do I clear the ImageEditor cach?
The ImageEditor does not have its own logic for keeping the loaded images in the cache (unless its ImageStorageLocations=Cache property is not configured). If you are uploading the images following the approach from this live demo, though, the uploaded image will be added to the application cache for 20 minutes:
protected
void
AsyncUpload1_FileUploaded(
object
sender, FileUploadedEventArgs e)
{
//Clear changes and remove uploaded image from Cache
RadImageEditor1.ResetChanges();
Context.Cache.Remove(Session.SessionID +
"UploadedFile"
);
using
(Stream stream = e.File.InputStream)
{
byte
[] imgData =
new
byte
[stream.Length];
stream.Read(imgData, 0, imgData.Length);
MemoryStream ms =
new
MemoryStream();
ms.Write(imgData, 0, imgData.Length);
Context.Cache.Insert(Session.SessionID +
"UploadedFile"
, ms,
null
, DateTime.Now.AddMinutes(20), TimeSpan.Zero);
}
}
Please note that this is only a sample approach used for our demo application purposes and I would suggest that you review the following MSDN resources in order to consider how to integrate it best in the target by you scenario:
Cache.Insert Method
Cache.Remove Method​
Cache Methods
Regards,
Vessy
Telerik



Okay, I lied. I removed that code and the original upload didn't work....
protected void RadImageEditor1_ImageLoading(object sender, ImageEditorLoadingEventArgs args)
{
//Handle Uploaded images
if (!Object.Equals(Context.Cache.Get(Session.SessionID + "UploadedFile"), null))
{
using (EditableImage image = new EditableImage((MemoryStream)Context.Cache.Get(Session.SessionID + "UploadedFile")))
{
args.Image = image.Clone();
args.Cancel = true;
}
}
}
How do I get the upload to work without reloading the picture on susequent calls to the window?​
That is expected, as the image uploading logic implemented by us in the demo is based on caching the uploading image and loading it from the cache after that. In order to customize this logic to cache the image for less than 20 minutes you will need to decrease the fourth parameter of the Cache.Insert() method and make sure that you clear the cache each time when the window holding the ImageEditor is closed. Examining the articles provided in my previous reply should be helpful for you in implementing the desired custom scenario.
Regards,
Vessy
Telerik

You can attach a handler to the ImageEditor's client-side ClientSaved event which is raised just after the image is saved, and populate a label from its handler. A similar approach is used in the following demo:
ImageEditor - Save Image to a Custom Location
Regards,
Vessy
Telerik

In order to avoid the saving of the image in its default location, you have to cancel the arguments of the ImageSaving event:
protected
void
RadImgEdt_ImageSaving(
object
sender, Telerik.Web.UI.ImageEditorSavingEventArgs args)
{
...
args.Cancel =
true
;
}
As for you other question, I have just answer your other thread on the subject and will advice that will continue the discussion about it there.
Regards,
Vessy
Telerik