Custom Image Field for Lists
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.
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
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"
/>
Microsoft JScript runtime error: Unable to get value of the property 'get_contentFrame': object is null or undefined
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")]
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 >>
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!
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]
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
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?
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 >>