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

Forums / General Discussions / Change Sort Order of Upload Images "Select an Album" DropDown?

Change Sort Order of Upload Images "Select an Album" DropDown?

2 posts, 1 answered
  1. Daniel
    Daniel avatar
    2 posts
    Registered:
    29 Jul 2011
    08 Aug 2011
    Link to this post
    Is there any way to set a sort order for the "select an album" dropdown list on the "Upload Images" form? In particular I am talking about the form that is found through this navigation path:

    Dashboard -> Content -> Images -> Upload Images

    After selecting an image to upload, the user is allowed to select an album to put the image in. This list seems to be sorted in a random manner. In our CMS instance, we have 250+ image albums, and it makes it extremely difficult to find the correct album when the list isn't sorted alphabetically.

    Is there a setting to enable sorting for this dropdown?

    Thanks!
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    11 Aug 2011
    Link to this post
    Hi Daniel,

    That's a tough one- we do not have a direct configuration setting exposed for that, however it's possible to implement a SortExpression and map the template for the UploadDialog. I've attached a modified template to this reply which will sort the Albums alphabetically, however, please feel free to modify the DefaultSortExpression property of the binder on the below template according to the use case scenario:
    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sfFields" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.ContentUI.Views.Backend.Detail" TagPrefix="sfDetail" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Validation.Definitions" TagPrefix="sfvalidation" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Workflow.UI" TagPrefix="sitefinity" %>
     
    <sitefinity:ResourceLinks id="resourcesLinks" runat="server">
      <sitefinity:ResourceFile Name="Styles/Ajax.css" />
    </sitefinity:ResourceLinks>
     
    <sitefinity:ClientLabelManager id="clientLabelManager" runat="server">
        <Labels>
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="OneItemHasBeenSuccessfullyUploaded" runat="server" />
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="MultipleItemsHaveBeenSuccessfullyUploaded" runat="server" />
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="YouMustSelectLibraryNameInWhichToUploadItemName" runat="server" />
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="WhichItemNameToUpload" runat="server" />
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="Uploading" runat="server" />
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="UploadDone" runat="server" />
            <sitefinity:ClientLabel ClassId="LibrariesResources" Key="YouHaveUnsavedChangesWantToLeavePage" runat="server" />
        </Labels>
    </sitefinity:ClientLabelManager>
     
    <fieldset class="sfNewContentForm">
      <asp:LinkButton ID="backButton" runat="server" CssClass="sfBack" OnClientClick="return false;" />
      <h1 id="dialogTitle" runat="server"></h1>
      <sfFields:FormManager id="formManager" runat="server"/>
       
        <div id="mainForm" runat="server">  
            <div class="sfForm sfFirstForm">
                <sfFields:FileField id="fileUpload" runat="server" DisplayMode="Write" CssClass="sfFormIn" />
            </div>
         
            <sitefinity:PromptDialog ID="createLibPrompt" runat="server" Mode="Input" ShowOnLoad="false"
                Title="<%$Resources:Labels, CreateAParameter %>" TextFieldTitle="<%$Resources:LibrariesResources, LibraryNameText %>"
                TextFieldExample="<%$Resources:LibrariesResources, LibraryNameExample %>">
                <CustomTemplate>
                    <sitefinity:TextField ID="libraryTitle" runat="server" DisplayMode="Write"></sitefinity:TextField>
                </CustomTemplate>
                <Commands>
                    <sitefinity:CommandToolboxItem Text="<%$ Resources:LibrariesResources, CreateThisLibrary %>" CommandName="createLibrary" CommandType="CreateButton" WrapperTagName="LI"></sitefinity:CommandToolboxItem>
                    <sitefinity:CommandToolboxItem Text="<%$ Resources:Labels, Cancel %>" CommandName="cancel" CommandType="CancelButton" WrapperTagName="LI"></sitefinity:CommandToolboxItem>
                </Commands>
            </sitefinity:PromptDialog>
            <sitefinity:Message ID="messageControl" runat="server" RemoveAfter="-1" CssClass="sfUploadedImgMsg" />
         
        <div id="librarySelector" runat="server" class="sfForm">
            <div class="sfFormIn">
                <asp:Label ID="librarySelectorTitle" runat="server" CssClass="sfTxtLbl" AssociatedControlID="librariesDropDown" />
                     
                        <asp:DropDownList ID="librariesDropDown" runat="server">
                        </asp:DropDownList>
                        <sitefinity:GenericCollectionBinder id="librariesBinder" runat="server"
                                                            TargetId="librariesDropDown"
                                                            ServiceUrl="~/Sitefinity/Services/Content/ContentService.svc/"
                                                            BindOnLoad="false"
                                                            DefaultSortExpression="Title ASC"
                                                            >
                            <Containers>
                                <sitefinity:BinderContainer ID="BinderContainer1" runat="server" RenderContainer="false" ContainerTag="OPTION" TemplateHolderTag="SELECT">
                                    <option sys:value="{{Id}}">{{Title}}</option>
                                </sitefinity:BinderContainer>
                            </Containers>
                        </sitefinity:GenericCollectionBinder>
                        <asp:Literal ID="orLiteral" runat="server" Text="<%$Resources:Labels, or %>"></asp:Literal>
                        <asp:HyperLink ID="lnkCreateLibrary" NavigateUrl="javascript:void(0);" runat="server" Text="<%$Resources:LibrariesResources, CreateNewLibrary %>"></asp:HyperLink>
                </div>
            </div>
         
            <sfDetail:SectionControl id="taxonomiesSelector" runat="server"
                                        WrapperTag="FIELDSET"
                                        CssClass="sfForm sfExpandableForm"
                                        Expanded="false">
            </sfDetail:SectionControl>  
        </div>
        <sitefinity:WorkflowMenu id="workflowMenu" runat="server" CssClass="sfButtonArea sfMainFormBtns" />
        
        <sitefinity:CommandBar id="successCommandBar" runat="server"
                WrapperTag="div"
                WrapperCssClass="sfButtonArea sfMainFormBtns"
                Displayed="false">
            <Commands>
                <sitefinity:CommandToolboxItem runat="server"
                                                CommandName="viewAll"
                                                CommandType="NormalButton"
                                                CssClass="sfPrimary" />
                <%--<sitefinity:CommandToolboxItem runat="server"
                                                CommandName="batchEdit"
                                                CommandType="NormalButton" />--%>
                <sitefinity:LiteralToolboxItem runat="server">
                <ItemTemplate>
                    <asp:Literal ID="Literal12" runat="server" Text="<%$Resources:Labels, or %>"></asp:Literal>
                </ItemTemplate>
                </sitefinity:LiteralToolboxItem>
                <sitefinity:CommandToolboxItem runat="server"
                                                CommandName="uploadOther"
                                                CommandType="CancelButton"
                                                CssClass="sfAddOther" />
            </Commands>
        </sitefinity:CommandBar>
     
    </fieldset>
     
    <asp:HiddenField ID="dialogInstanceId" runat="server" />
     
    <script type="text/javascript">
     
        $("body").addClass("sfFormDialog");
     
        function createDialog(commandName, dataItem, self, dialog, params, key, commandArgument) {
            $find('<%= dialogInstanceId.Value %>').prepareDialog(commandName, dataItem, self, dialog, params, key, commandArgument);
        }
         
    </script>

    Once you've added the template, please go to Sitefinity backend -> Administration->Settings->Advanced->Controls->ViewMap->Create new,  and fill in the fields accordingly:
    : Telerik.Sitefinity.Modules.Libraries.Web.UI.UploadDialog
    LayoutTemplatePath: relative path to the customized template in your project



    Regards,
    Boyan Barnev
    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
    Answered
2 posts, 1 answered