More in this section

Forums / Developing with Sitefinity / Sitefinity 3.6 - LibrarySelector usercontrol in templates

Sitefinity 3.6 - LibrarySelector usercontrol in templates

10 posts, 0 answered
  1. Imran
    Imran avatar
    75 posts
    Registered:
    17 Jan 2007
    18 Feb 2009
    Link to this post
    Hello

    I need to add some custom properties to my blogs, and I followed this article:

    http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bcge-b1154T-cgb.aspx

    Everything works fine, but when I tried to include LibrarySelector user control from this article:

    http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bakd-b1154T-cgh.aspx

    I get the following error: Could not resolve type for tag "uc:LibrarySelector". Make sure the proper namespace is registered.

    Any ideas on how to resolve this? Many thanks
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    19 Feb 2009
    Link to this post
    Hello Imran,

    Please, make sure you have registered the LibrarySelector control in the template:

    <%@ Register TagPrefix="uc" Src="~/UserControls/LibrarySelector.ascx" TagName="LibrarySelector" %> 

    Also, note that we found some problems with using external templates in v3.6. Currently, we are working on the issues and their fix will be available in the upcoming hotfix.

    Kind regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Imran
    Imran avatar
    75 posts
    Registered:
    17 Jan 2007
    20 Feb 2009
    Link to this post
    Thanks Pepi

    Is the hotfix out? Is it Sitefinity_3_6_1861_dev_patch.zip ?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Feb 2009
    Link to this post
    Hello Imran,

    The service pack will be released later today or on Monday.
    Sitefinity_3_6_1861_dev_patch.zip is a patch that you should apply if you want to upgrade your website from versions prior 3.6. Just to let you know it is compiled against .net framework 3.5.
    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Imran
    Imran avatar
    75 posts
    Registered:
    17 Jan 2007
    23 Feb 2009
    Link to this post
    Hey guys

    I've downloaded 3.6 hotfix and tried to add the library selector control into my templates and its still giving the same error.

    Any ideas ?
  6. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    25 Feb 2009
    Link to this post
    Hello Imran,

    We cannot reproduce the described behavior with the Hotfix. So, please, make sure everything is properly set:
    1. Create ~/App_Data/Configuration/Telerik.Sitefinity.Configuration.ControlsConfig.xml file.
    2. Download the provided external templates from My Client.net (note that ExternalTemplates.zipis different for the standard/community editions, as well as for the .NET version your project is based on) and add the appropriate <viewSettings> element. The example below is related to edit mode of the post:

    <?xml version="1.0" encoding="utf-8"?> 
    <controlsConfig> 
      <viewMap> 
        <!--Provides user interface for editing a blog post in the blogs module.--> 
        <viewSettings hostType="Telerik.Blogs.WebControls.Admin.PostEditView" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Blogs/PostEdit.ascx" />    
      </viewMap> 
    </controlsConfig> 

    3. Copy the .ascx file in the folder pointed by the layoutTemplatePath attribute.
    4. Copy the .ascx.resx file in the Blogs module App_LocalResources folder.
    5. Make your changes to the copied .ascx file:
         - Register LibrarySelector control in the template:

    <%@ Register Src="~/UserControls/LibrarySelector.ascx" TagName="LibrarySelector" TagPrefix="uc" %> 

    Note that Src attribute should be set to the location of the LibrarySelector.ascx file.

         - Declare the control in the ContentMetaFields container:

    <li> 
        Image Path: 
        <uc:LibrarySelector ID="ImageSelector" runat="server" DisplayMode="Image" /> 
    </li> 

    Do let us know how it goes.

    All the best,
    Pepi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Imran
    Imran avatar
    75 posts
    Registered:
    17 Jan 2007
    25 Feb 2009
    Link to this post
    Pepi,

    Many thanks for the detailed explanation.. i, for some reason was missing step 4.


    Thanks
  8. Shaun Mitchem
    Shaun Mitchem avatar
    12 posts
    Registered:
    05 Aug 2003
    30 Mar 2009
    Link to this post
    I'm posting about a new issue but have added it to this thread as it is an extension of the same blog customisation that we were working on previously.

    We now want to add a second library selector to the same blog post (so that we can upload an image for the site homepage and the summary page):

                                  
    <li>   
       <asp:Label ID="Label4" AssociatedControlID="Home_Page_Image" runat="server"
        <asp:Literal ID="Literal23" runat="server" Text="Home Page Image"></asp:Literal> <em id="Home_Page_ImageLabel" runat="server"></em></asp:Label>   
       <uc:LibrarySelector ID="Home_Page_Image" runat="server" DisplayMode="Image"></uc:LibrarySelector>   
    </li>    
    <li>   
       <asp:Label ID="Label5" AssociatedControlID="List_Page_Image" runat="server"
        <asp:Literal ID="Literal7" runat="server" Text="List Page Image"></asp:Literal> <em id="List_Page_ImageLabel" runat="server"></em></asp:Label>   
       <uc:LibrarySelector ID="List_Page_Image" runat="server" DisplayMode="Image" ></uc:LibrarySelector>   
    </li> 


    The first one works fine; however, whenever I add an image to the second library selector ("List_Page_Image"), it updates the text box of the first selector ("Home Page Image") so List_Page_Image is never populated
  9. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    30 Mar 2009
    Link to this post
    Hello Shaun,

    This is a known issue with LibrarySelector control. The easiest fix is to generate a javascript function which has a different name for each instance of the control:

    .ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LibrarySelector.ascx.cs" Inherits="UserControls_Libraries_LibrarySelector" %> 
     
    <asp:TextBox ID="LibraryTextBox" runat="server"></asp:TextBox> 
    <asp:LinkButton ID="picker" runat="server" Text="Select"></asp:LinkButton> 
     
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleOnPageLoad="false"
        <Windows> 
            <telerik:RadWindow ID="RadWindow1"  
            runat="server"  
            Width="750"  
            Height="515"  
            VisibleOnPageLoad="false"
            </telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 
     
    <script language="javascript"
    function CallBackFunction<%=this.ClientID %>(radWindow, returnValue) 
        var oArea = document.getElementById('<%=this.LibraryTextBox.ClientID %>'); 
        if (returnValue)  
        { 
                oArea.value = <%=ReturnValue %>
        } 
    </script> 

    .ascx.cs
    using System; 
    using System.Collections; 
    using System.Configuration; 
    using System.Data; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.HtmlControls; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.ComponentModel; 
     
    public partial class UserControls_Libraries_LibrarySelector : System.Web.UI.UserControl, ITextControl 
        #region Public Properties 
     
        public LibraryMode DisplayMode 
        { 
            get 
            { 
                return this.displayMode; 
            } 
            set 
            { 
                this.displayMode = value; 
            } 
        } 
     
        protected string ReturnValue 
        { 
            get 
            { 
                return this.returnValue; 
            } 
            set 
            { 
                this.returnValue = value; 
            } 
        } 
        #endregion 
     
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (this.displayMode == LibraryMode.Auto || this.displayMode == LibraryMode.Image) 
            { 
                RadWindow1.NavigateUrl = "~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx"
                this.returnValue = "returnValue.src"
            } 
            else 
            { 
                RadWindow1.NavigateUrl = "~/Sitefinity/UserControls/Dialogs/DocumentEditorDialog.aspx"
                this.returnValue = "returnValue"
            } 
     
     
            RadWindow1.OpenerElementID = picker.ClientID; 
            RadWindow1.ClientCallBackFunction = "CallBackFunction" + this.ClientID; 
             
       } 
        #region Private Members 
     
        private LibraryMode displayMode; 
        private string returnValue; 
        #endregion 
     
        public enum LibraryMode 
        {  
            Auto, 
            Image, 
            Document 
        } 
        #region ITextControl Members 
     
        string ITextControl.Text 
        { 
            get 
            { 
                return this.LibraryTextBox.Text; 
            } 
            set 
            { 
                this.LibraryTextBox.Text = value; 
            } 
        } 
        #endregion 
     

    Let us know if this helps.

    Best wishes,
    Pepi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  10. Shaun Mitchem
    Shaun Mitchem avatar
    12 posts
    Registered:
    05 Aug 2003
    30 Mar 2009
    Link to this post
    that worked - thanks for you prompt response
Register for webinar
10 posts, 0 answered