This is a migrated thread and some comments may be shown as answers.

Load image from code behind and export image to custom location

9 Answers 1112 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Archana
Top achievements
Rank 1
Archana asked on 01 Jun 2018, 10:40 AM

Hi,

How do I set the path of ImageUrl in ImageEditor from code behind? radImageEditor.ImageUrl="<file path>" did not load the image.

Also, how do I export the image to a custom file path?

9 Answers, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 01 Jun 2018, 11:09 AM
Hi Archana,

RadImageEditor can work only with virtual paths to images placed inside the application root directory, so setting its ImageUrl from the code-behind should look like follows:
protected void Page_Load(object sender, EventArgs e)
{
    RadImageEditor1.ImageUrl = "~/Images/image1.jpg";
}

As for the saving the image to a custom location, you can do it in the control's ImageSaving event like demonstrated in this live demo:
https://demos.telerik.com/aspnet-ajax/imageeditor/examples/customsaving/defaultcs.aspx
protected void RadImgEdt_ImageSaving(object sender, Telerik.Web.UI.ImageEditorSavingEventArgs args)
 {
     //Save the image to a custom location
     string fullPath = Server.MapPath("../../images/testImages");
     string fileName = string.Format("relax-{0}.jpg", DateTime.Now.ToString("yyyyMMdd-hhmmss"));
     fullPath = Path.Combine(fullPath, fileName);
 
     Telerik.Web.UI.ImageEditor.EditableImage img = args.Image;
     img.Image.Save(fullPath);
     //lblError.Text = "File Saved";
     args.Argument = String.Format("The image is saved under the name: <strong>{0}</strong>.", fileName);
 
     args.Cancel = true;
 }


Regards,
Vessy
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Archana
Top achievements
Rank 1
answered on 04 Jun 2018, 05:18 AM
Thanks Vessy.. that helped.
0
Vessy
Telerik team
answered on 04 Jun 2018, 06:25 AM
Hi,

You are welcome, Archana. Let us know should you meed any further difficulties with our controls.

Regards,
Vessy
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
E.P.
Top achievements
Rank 1
answered on 05 Feb 2020, 03:06 AM

Hi,

 

In the linked page (which I've pasted below), there's a link to "Isolate this demo as a stand-alone application".

https://demos.telerik.com/aspnet-ajax/imageeditor/examples/customsaving/defaultcs.aspx

 

How do I get the demo project?

0
Vessy
Telerik team
answered on 05 Feb 2020, 10:11 AM

Hi Eli,

The whole demo application can be downloaded in the Download section of your Telerik account (the installation file name is  Telerik_UI_for_ASP.NET_AJAX_2020_1_114_Demos_Dev.msi):
https://www.telerik.com/account/product-download?product=RCAJAX

On a side note, the source code of each demo is available just below it, in the C#/VB tabs, next to the demo description: https://www.screencast.com/t/exAwq8dUYAqj

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
E.P.
Top achievements
Rank 1
answered on 06 Feb 2020, 06:52 AM

Thank you.

I'm finding it incredibly difficult to find the documentation. I went to one link that points to another link, which points back to the first link multiple times before I clicked on something (I can't even remember what) and finally found it.

Anyway, I previously copied dll's and config information from an example project sent to me just before the purchase which seems to work fine in my project (other than not being able to figure out how to find the licence key in my account), but the video series has led me to this page:

https://docs.telerik.com/devtools/aspnet-ajax/getting-started/first-steps

In point 2 "Add the Controls to Your Project", it says

"Go to Telerik > UI for ASP.NET AJAX > Convert to Telerik Web Application"

But I have no "Telerik" menu in my VS 2017.

I've downloaded the control panel and installed "Telerik UI for ASP.NET AJAX"

In Visual Studio, under VS marketplace, I've installed
"Progress Telerik UI for ASP.NET AJAX Extension"
but can not find
"Telerik ASP.NET AJAX VSExtensions" as per their image

Can I get some help with what I should do?

I'm also not happy with the idea of clicking some random button to "convert my project" which has hundreds if not thousands of other pages that should not be touched, affected or converted in any way, and I don't like the idea of this. If there's a series of steps that I know exactly what to add myself so that I can see everything that is changed, I would prefer that.

Thank you

0
Vessy
Telerik team
answered on 11 Feb 2020, 08:14 AM

Hi Eli,

The "Progress Telerik UI for ASP.NET AJAX Extension" is the name of the latest version of the extensions, so it is the proper one. Telerik ASP.NET AJAX VSExtensions is their name back in 2018, we will make sure to update the image with the new name as soon as possible.

If you prefer full manual control over your project, you can copy the Telerik assemblies to the ~/bin and add references to them through the Visual Studio interface. You can take the needed DLLs from the installation folder of the controls, the path to which is usually like follows:
C:\Program Files (x86)\Progress\Telerik UI for ASP.NET AJAX R1 2020\Bin45

In this case you should also update the web.config:
https://docs.telerik.com/devtools/aspnet-ajax/general-information/web-config-settings-overview#mandatory-additions-to-the-webconfig

The controls come packaged in several assemblies and to get started, you only need Telerik.Web.UI.dll, Telerik.Web.UI.Skins.dll and Telerik.Web.Design.dll.

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
E.P.
Top achievements
Rank 1
answered on 14 Feb 2020, 05:06 AM
Thank you, that was very helpful.
0
Vessy
Telerik team
answered on 18 Feb 2020, 03:06 PM

Hi,

You are welcome, Eli - let us know in case any further question about our controls occurs.

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
ImageEditor
Asked by
Archana
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Archana
Top achievements
Rank 1
E.P.
Top achievements
Rank 1
Share this question
or