Intra Module Image Selector
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
>
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