Intra Module Image Selector

Posted by Community Admin on 04-Aug-2018 11:49

Intra Module Image Selector

All Replies

Posted by Community Admin on 01-Dec-2011 00:00

Hi,

I am trying to create an Intra Module, I need to be able to select and image.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddEditView.ascx.cs" Inherits="SitefinityWebApp.Modules.Testimonials.Admin.AddEditView" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Designers" TagPrefix="sfy" %>
 
<h1 class="sfBreadCrumb">
    Testimonials</h1>
<div class="sfMain sfClearfix">
    <div class="sfContent">
        <div class="rgTopOffset sfWorkArea">
            <fieldset class="sfNewContentForm">
                <div class="sfFormIn">
                    <ul>
                        <li>
                            <asp:Label ID="lblTitleText" runat="server" AssociatedControlID="TitleText" Text="Title Text" CssClass="sfTxtLbl" />
                            <asp:TextBox ID="TitleText" runat="server" CssClass="sfTxt" />
                        </li>
                        <li>
                            <asp:Label ID="lblPosition" runat="server" AssociatedControlID="Position" Text="Position" CssClass="sfTxtLbl" />
                            <asp:TextBox ID="Position" runat="server" CssClass="sfTxt" />
                        </li>
                                                 
                        <li>
                            <asp:Label ID="lblImage" runat="server" Text="Image" />
                            <sf:ImageField ID="productImageField" runat="server" DataFieldType="Telerik.Sitefinity.Model.ContentLinks.ContentLink" DisplayMode="Write" ShowDeleteImageButton="false" CssClass="sfprofileField sfprofileAvatar"/>
                        </li>
                        <li>   
                            <sfy:MediaContentSelectorView
                                id="selectorView"
                                runat="server"
                                ContentType="Telerik.Sitefinity.Libraries.Model.Image"
                                ParentType="Telerik.Sitefinity.Libraries.Model.Album"
                                LibraryBinderServiceUrl="~/Sitefinity/Services/Content/AlbumService.svc/"
                                MediaContentBinderServiceUrl="~/Sitefinity/Services/Content/ImageService.svc/"
                                MediaContentItemsListDescriptionTemplate="Telerik.Sitefinity.Resources.Templates.Designers.Libraries.Images.ImageItemDescriptionTemplate.htm"
                                DisplayResizingOptionsControl="false"
                                ShowOpenOriginalSizeCheckBox="false">
                            </sfy:MediaContentSelectorView>
                        </li>
                    </ul>
                    <p>
                        <asp:Button ID="btnSave" runat="server" Text="Save Testimonial" OnClick="btnSave_Click" />
                        or <a href="<%= ResolveUrl(Telerik.Sitefinity.Web.SiteMapBase.GetActualCurrentNode().ParentNode.Url)%>">Cancel and go back to Testimonials</a></p>
                </div>
            </fieldset>
        </div>
    </div>
</div>

My issue is how do I get the value of the selected image out of either the MediaContentSelectorView or the sf:ImageField.

Or am I doing this complete WRONG and if so how do I go about doing it.

thanks

Posted by Community Admin on 06-Dec-2011 00:00

Hello Martin,

I have attached a project with the implementation of the image selctor. The credentials for the project are admin/password . The approach is to use another field

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

In the project you will find the implementaion of the field. The EditorContentManagerDialog as well as the MediaContentSelectorView need the control implementaion to run.
EditorContentManagerDialog opens the dialog in RadWindow (this si how dialogs are opened in Sitefinity). The RadWindow calls the dialog code file which loads the  Dialog template (.ascx) and the .js file that provides functionality.
It is important to note a call to the dialog needs to be made from Global.asax as you can also observe in the project.

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
[View:/cfs-file/__key/communityserver-discussions-components-files/296/319356_5F00_ImageSelectorUC_2D00_part2.rar:320:240]
[View:/cfs-file/__key/communityserver-discussions-components-files/296/319355_5F00_ImageSelectorUC_2D00_part1.rar:320:240]

This thread is closed