1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / MediaContentSelector and Generic Page Selector

MediaContentSelector and Generic Page Selector

4 posts, 0 answered
  1. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    09 Mar 2012
    Link to this post
    I am using the MediaContentSelector and GenericPageSelector on an Add/Edit admin page similar to the intra-site testimonials module that is found in the SDK.  Through browsing the forums I came across the following code to insert these on the page.
    <li><asp:Label ID="lblBackgroundImage" runat="server" Text="Image" CssClass="sfTxtLbl" />
    <asp:Image ID="imgBackgroundImage" runat="server" />
    <sf1: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">
    </sf1:MediaContentSelectorView>
    </li>
    <li>
    <asp:Label ID="lblRelatedLink" runat="server"  Text="RelatedLink" CssClass="sfTxtLbl" />
           <sitefinity:GenericPageSelector
                   id="GenericPageSelector1"
                   runat="server"
                   RootNodeID="F669D9A7-009D-4d83-DDAA-000000000002"
                   WebServiceUrl="~/Sitefinity/Services/Pages/PagesService.svc/"
                    ShowOnlySelectedAsGridOnLoad="true"
                     MarkItemsWithoutTranslation="true"
                     AllowMultipleSelection="false" />
    </li>

    My MediaContentSelector is just showing Loading and continues to do so forever and it never shows my image library.  The left pane does show my libraries.  Is there anything I can do to get it to actually show my images.


    My GenericPageSelect is throwing the following error whenever I try to submit the form.
    A potentially dangerous Request.Form value was detected from the client (ctl06_GenericPageSelector1_ctl00_ctl00_itemsTreeTable_ctl00_ctl00_treeTable_ClientState="...\n\t\t\t\t<div class=\"sfTreeT...").

    I know I can turn off page validation in normal asp.net pages but not sure how I should handle in sitefinity.
  2. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    12 Mar 2012
    Link to this post
    So my problem with the Generic Page Selector was solved by disabling page validation.  I also figured out why my images in my Media Content Selector is not working.  ITs because a javascript method called "sitefinityLocaleFormat()" throwing the error " is not a function". 
    I did some searching in the forums and there was one post asking something similar so I added a script manager, ajax toolkit scriptmanager, and added  [RequireScriptManager] to the class and I am still not having any luck.

    Anything I can do to get this error to go away?
  3. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    14 Mar 2012
    Link to this post
    Hi Brett,

     Can you give me details on the exact javascript code that you are executing and more specifically on the one that is throwing the error?

    Regards,
    Svetoslav Petsov
    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
  4. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    14 Mar 2012
    Link to this post
    Its coming from a ScriptResource.axd file. Line 98 of the code below:
    001.function anonymous(__containerElement, __data, $dataItem, $index, __referenceNode, __parentContext, __instanceId) {
    002.$index = typeof $index === "number" ? $index : __instanceId;
    003.var $component, __componentIndex, __e, __f, __topElements = [], __d = 0, __p = [__containerElement], $element = __containerElement, $context = new Sys.UI.TemplateContext, $id = function (prefix) {return $context.getInstanceId(prefix);};
    004.$context.data = typeof __data === "undefined" ? null : __data;
    005.$context.components = [];
    006.$context.nodes = __topElements;
    007.$context.dataItem = $dataItem;
    008.$context.index = $index;
    009.$context.parentContext = __parentContext;
    010.$context.containerElement = __containerElement;
    011.$context.insertBeforeNode = __referenceNode;
    012.$context.template = this;
    013.with ($dataItem || {}) {
    014.__d++;
    015.__topElements.push(document.createTextNode("\n\t\t\t"));
    016.$element = __p[__d] = document.createElement("LI");
    017.$element.__mstcindex = $context._tcindex;
    018.$component = $element;
    019.$element.className = "sys-container";
    020.__topElements.push($element);
    021.__d++;
    022.$element = __p[__d] = document.createElement("A");
    023.$component = $element;
    024.$element.className = "selectCommand";
    025.$component = $element;
    026.__e = document.createAttribute("href");
    027.__e.nodeValue = Sys.UI.Template._checkAttribute("href", "javascript:void(0);");
    028.$element.setAttributeNode(__e);
    029.__p[__d - 1].appendChild($element);
    030.__d++;
    031.__p[__d - 1].appendChild(document.createTextNode("\n "));
    032.$element = __p[__d] = document.createElement("IMG");
    033.$component = $element;
    034.__e = document.createAttribute("alt");
    035.__e.nodeValue = Title;
    036.$element.setAttributeNode(__e);
    037.$component = $element;
    038.__e = document.createAttribute("src");
    039.__e.nodeValue = Sys.UI.Template._checkAttribute("src", ThumbnailUrl);
    040.$element.setAttributeNode(__e);
    041.__p[__d - 1].appendChild($element);
    042.__d++;
    043.--__d;
    044.$element = __p[__d];
    045.__p[__d - 1].appendChild(document.createTextNode("\n "));
    046.$element = __p[__d] = document.createElement("SPAN");
    047.$component = $element;
    048.$element.className = "imgSelect";
    049.__p[__d - 1].appendChild($element);
    050.__d++;
    051.__p[__d - 1].appendChild(document.createTextNode(" "));
    052.--__d;
    053.$element = __p[__d];
    054.__p[__d - 1].appendChild(document.createTextNode("\n"));
    055.--__d;
    056.$element = __p[__d];
    057.__p[__d - 1].appendChild(document.createTextNode("\n"));
    058.$element = __p[__d] = document.createElement("DIV");
    059.$component = $element;
    060.$element.className = "sfTooltipWrp";
    061.__p[__d - 1].appendChild($element);
    062.__d++;
    063.__p[__d - 1].appendChild(document.createTextNode("\n\t"));
    064.$element = __p[__d] = document.createElement("UL");
    065.__p[__d - 1].appendChild($element);
    066.__d++;
    067.__p[__d - 1].appendChild(document.createTextNode("\n "));
    068.$element = __p[__d] = document.createElement("LI");
    069.__p[__d - 1].appendChild($element);
    070.__d++;
    071.__p[__d - 1].appendChild(document.createTextNode("Title: "));
    072.__p[__d - 1].appendChild(document.createTextNode(Title));
    073.--__d;
    074.$element = __p[__d];
    075.__p[__d - 1].appendChild(document.createTextNode("\n\t "));
    076.$element = __p[__d] = document.createElement("LI");
    077.__p[__d - 1].appendChild($element);
    078.__d++;
    079.__p[__d - 1].appendChild(document.createTextNode("Album: "));
    080.__p[__d - 1].appendChild(document.createTextNode(LibraryTitle));
    081.--__d;
    082.$element = __p[__d];
    083.__p[__d - 1].appendChild(document.createTextNode("\n\t "));
    084.$element = __p[__d] = document.createElement("LI");
    085.__p[__d - 1].appendChild($element);
    086.__d++;
    087.__p[__d - 1].appendChild(document.createTextNode("Dimensions: "));
    088.__p[__d - 1].appendChild(document.createTextNode(Width));
    089.__p[__d - 1].appendChild(document.createTextNode("x"));
    090.__p[__d - 1].appendChild(document.createTextNode(Height));
    091.--__d;
    092.$element = __p[__d];
    093.__p[__d - 1].appendChild(document.createTextNode("\n\t "));
    094.$element = __p[__d] = document.createElement("LI");
    095.__p[__d - 1].appendChild($element);
    096.__d++;
    097.__p[__d - 1].appendChild(document.createTextNode("Created on "));
    098.__p[__d - 1].appendChild(document.createTextNode(DateCreated.sitefinityLocaleFormat("dd MMM, yyyy HH:mm")));
    099.--__d;
    100.$element = __p[__d];
    101.__p[__d - 1].appendChild(document.createTextNode("\n "));
    102.--__d;
    103.$element = __p[__d];
    104.__p[__d - 1].appendChild(document.createTextNode("\n"));
    105.--__d;
    106.$element = __p[__d];
    107.--__d;
    108.$element = __p[__d];
    109.__topElements.push(document.createTextNode("\n\t\t"));
    110.--__d;
    111.}
4 posts, 0 answered