View List of News & Blogs with MediaContentSelectorView
I am looking for the example on how to use MediaContentSelectorView to view a list of news and blogs which user can select..prety similar with the images. I had tried couple times but i could get around it....
<sf:MediaContentSelectorView ID="selImageView" runat="server" ContentType="Telerik.Sitefinity.Libraries.Model.Image"
ParentType="Telerik.Sitefinity.Libraries.Model.Album" LibraryBinderServiceUrl="~/Sitefinity/Services/Content/AlbumService.svc/"
MediaContentBinderServiceUrl="~/Sitefinity/Services/Content/NewsItemService.svc/"
MediaContentItemsListDescriptionTemplate="Telerik.Sitefinity.Resources.Templates.Designers.Libraries.Images.ImageItemDescriptionTemplate.htm"
DisplayResizingOptionsControl="false" ShowOpenOriginalSizeCheckBox="false">
</sf:MediaContentSelectorView>
Hello John,
There is control Telerik.Sitefinity.Web.UI.ControlDesign.ContentSelector tha tyou can use to select a content. The media selector will work only with images and documents, because it has specific data in its client component. Of course you can create your own selector following this article.
www.sitefinity.com/.../how-to-how-to-create-a-date-picker-control.html
Regards,
Ivan Dimitrov
the Telerik team
Hi Ivan,
I'm writing a custom widget similar to this forum post. It has various inputs aswell as an Image Picker. However I cant get my control designer to remember and persist the src of the image they select in the picker... What I'm expecting is that when they select an image, it gets the blue border background (that happens), then it saves the value of the src of the image, and I have that to use in my front end control to populate the src value of an image. Then when they go back into edit the control that image can be highlighted in blue again (although to be honest that is secondary, the most importnat bit is persisting the value to my widget, thats what I cant get to work..). I'm pasting relevant snippets here..
So heres the markup in my designer file:
<sf:MediaContentSelectorView ID="selectorView1" 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">
</sf:MediaContentSelectorView>
The js referencing the value of it (I'm sure this is where I'm going wrong)
refresh UI function: jQuery("#selectorView1").attr("src",controlData.ImagePath1);
applyChanges function: controlData.ImagePath1 = jQuery("#selectorView1").attr("src");
property in my widget:
private string _imgPath1;
public string ImagePath1
get
return this._imgPath1;
set
this._imgPath1 = value;
then in the markup of my widget I have this:
<li id="ImageSliderItem1" runat="server"> of which I need the background image to be the image selected within the image picker .. so
imageSliderItem1.Style.Add("background", "url(" + _imgPath1 + ") no-repeat center top transparent;");
Can you see immediately which bit is failing??? (as a further note this widget is working properly with normal inputs, so I know my approach has worked! Just the image picker is not working..)
thanks, Louise
Hi, is there any assistance available on my post?
Hi Louiseba,
Please put a breakpoint inside refreshUI and applyChanges functions to see what is the value you are getting and setting.
Best wishes,
Ivan Dimitrov
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 >>