Custom Image Field for Lists

Posted by Community Admin on 04-Aug-2018 19:33

Custom Image Field for Lists

All Replies

Posted by Community Admin on 16-Aug-2011 00:00

I have been looking for this with no success.  I am trying to add a custom image field for a list.  Can someone point me in the right direction.  Is this possible?  I need to be able to allow my users to select or upload an image for a specific list.  Any help on this is appreciated.

Posted by Community Admin on 19-Aug-2011 00:00

Hello Chris ,

One option is to create a custom field of type long text which will allow you to use image manager and select images from your computer or images module.

Another is to create a custom control to be used as custom field which will use <sf:EditorContentManagerDialog runat="server" ID="asyncImageSelector" DialogMode="Image" Width="540" HostedInRadWindow="true"  BodyCss /> <sfFields:FormManager id="formManager" runat="server"/>

Best wishes,
Stanislav Velikov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 22-Aug-2011 00:00

Hello Stanislav,

I've got a question about your second suggestion. I have added the following lines for my custom widget (FormManager included):

<sf:EditorContentManagerDialog runat="server" ID="asyncImageSelector" DialogMode="Image" Width="540" HostedInRadWindow="true" />

When I run my site I see my new image manager in my widget. But when I try to use it, I get the following javascript error:

Microsoft JScript runtime error: Unable to get value of the property 'get_contentFrame': object is null or undefined

What am I doing wrong? Furthermore, how can I finally save the image into my context? 

Maybe you've got an example how to use the sitefinity image manager for your own custom widget?
 
Best regards!
Peter

Posted by Community Admin on 22-Aug-2011 00:00

Hello Peter,

I have attached a working sample of EditorContentManagerDialog user control that can be reused for modules and custom fields. You will have to set the .js files as embedded resources and them in assemblyInfo.cs

[assembly: WebResource("SitefinityWebApp.Controls.Resources.Scripts.ImageSelectorDialog.js", "application/x-javascript")]

Register virtual paths needed for the templates to be called(they are embedded resource too). The Global.asax file is used to call the dialog in radwindow.

All the best,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 23-Aug-2011 00:00

Hello Stanislav,

thank you for your reply. However, I cannot figure out how to use the ImageSelector in my custom widget. I have successfully added the files to my project, but how do I get the ImageSelectorDialog in my widget (AddEdit-) ascx?

Thanks again!

Posted by Community Admin on 26-Aug-2011 00:00

Hi Peter,

Attached is a sample project that has the image selector registered and placed on a page. You can review how it is added in the project. The administrator credentials are (admin/password). A virtual path is registerred for the control you can review it in Administration->Settings->Advanced->VirtualPathSettings->VirtualPaths (Ctrls).
The sample functions with having RadWindow on a control (SelectorUserControl.ascx) and it calls another .ascx file which contains the dialog. The dialog is an embedded resource so it can only be called with the registered virtual path Ctrls.

Best wishes,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

[View:/cfs-file/__key/communityserver-discussions-components-files/296/295486_5F00_289412_2D00_ImageSelectorUC_2D00_part1.rar:320:240]

[View:/cfs-file/__key/communityserver-discussions-components-files/296/295487_5F00_289413_2D00_ImageSelectorUC_2D00_part2.rar:320:240]

Posted by Community Admin on 26-Aug-2011 00:00

Hi Stanislav,

Thank you for your example, it's already up and running. I'll keep you posted when I have successfully added the ImageSelector to my custom widget.

Best regards,
Peter

Posted by Community Admin on 31-Aug-2011 00:00

Hi Stanislav,
I'm using Sitefinity 4.2 but I do not recognize properties or methods that are inherited, for example LayoutTemplatePath. There is some example with the new version?

Posted by Community Admin on 07-Sep-2011 00:00

Hello Francisco,

The layout template path is a way to add reference to .ascx which has a build action set to embedded resource. When  you want to use this embedded resource you have to call it from the assembly trough virtual path.
Here is a sample in the documentation. I have attached a custom control for your reference. Also this topic describes the whole process.

All the best,
Stanislav Velikov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

This thread is closed