More in this section

Forums / Developing with Sitefinity / Intra Module Image Selector

Intra Module Image Selector

2 posts, 0 answered
  1. martin
    martin avatar
    36 posts
    Registered:
    30 Nov 2008
    01 Dec 2011
    Link to this post
    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
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    06 Dec 2011
    Link to this post
    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
2 posts, 0 answered