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

Forums / Developing with Sitefinity / Url WebEditor for Images and Documents module??

Url WebEditor for Images and Documents module??

3 posts, 0 answered
  1. Richard Murphy
    Richard Murphy avatar
    6 posts
    Registered:
    23 Mar 2006
    10 Dec 2008
    Link to this post
    Hello. My CMS users store their images and documents in the Sitefinity  Images and Documents module.

    They would like to be able choose an image URL from their libraries to in one of the user controls I have made for them.

    Astonishingly, there appears to be no equivalent to the Telerik.FileManager.UrlWebEditor type for the Images and Documents library.

    Please could you advise urgently? Thanks!
  2. Andrei
    Andrei avatar
    553 posts
    Registered:
    27 Nov 2008
    11 Dec 2008
    Link to this post
    Hi, I am currently trying to evaluate Sitefinity and see if it will do what i need it to do before buying. I am trying to add a UserControl with button on it, but I can not make the Property PostBackUrl to show a Select button for the users to browse to a page and select it that way.

    Can someone tell me what editor i need to use in Visual Studio so that when I load the UserControl it will have a Select button against the PostBackUrl property.

    Thank you
  3. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    11 Dec 2008
    Link to this post
    Hello Richard Murphy,

    I suppose you used WebEditor attribute for design time support:

    [WebEditor("Telerik.FileManager.UrlWebEditor,Telerik.FileManager")]  
    public String ImageUrl  
    {  
       get;  
       set;  

    But it shows File structure of whole Sitefinity Web Site, not the Image&Documents Libraries (shown for example in Image Manager of RadEditor).

    We know that this is problem in our realization and we are sorry for the the inconvinience.

    However you can use this walkaround to open Dialog Window for Image & Documents:
    Example how to open Image&Documents dialog when the user clicks on a server button:

    using Telerik.Cms.Web.UI; 
    using System.ComponentModel; 
    using Telerik.Web.UI; 
     
    namespace MyLibrary 
        public class ThumbnailControl : CompositeControl 
        { 
            [Browsable(false)] 
            public TextBox ThumbnailTextBox 
            { 
                get 
                { 
                    return this.FindControl("Thumbnail"as TextBox; 
                } 
            } 
     
            [WebEditor("Telerik.FileManager.UrlWebEditor, Telerik.FileManager")] 
            public string Thumbnail 
            { 
                get 
                { 
                    if (this.ThumbnailTextBox != null
                        return ThumbnailTextBox.Text; 
     
                    return string.Empty; 
                } 
                set 
                { 
                    ThumbnailTextBox.Text = value; 
                } 
            } 
     
            protected override void CreateChildControls() 
            { 
                this.Controls.Clear(); 
     
                if (this.itemTemplate == null
                { 
                    this.itemTemplate = new DefaultItemTemplate(); 
                } 
                this.itemTemplate.InstantiateIn(this); 
     
                if (this.Page != null
                { 
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"callback"this.GetScript(), true); 
                } 
            } 
     
     
            private string GetScript() 
            { 
                string result = "function CallBackFunction(radWindow, returnValue)" + 
                        "{" + 
                                "var oArea = document.getElementById('" + ThumbnailTextBox.ClientID + "');" + 
                                "if (returnValue) oArea.value = returnValue.src;" + 
                        "}"
     
                return result; 
            } 
     
            private ITemplate itemTemplate; 
     
            private class DefaultItemTemplate : ITemplate 
            { 
                public void InstantiateIn(Control container) 
                { 
                    TextBox txt = new TextBox(); 
                    txt.ID = "Thumbnail"
                    container.Controls.Add(txt); 
     
                    LinkButton btn = new LinkButton(); 
                    btn.ID = "picker"
                    btn.Text = "Select"
                    container.Controls.Add(btn); 
     
                    RadWindowManager manager = new RadWindowManager(); 
                    manager.ID = "RadWindowManager"
                    manager.VisibleOnPageLoad = false
                    container.Controls.Add(manager); 
     
                    RadWindow window = new RadWindow(); 
                    window.ID = "RadWindow1"
                    window.OpenerElementID = btn.ClientID; 
                    window.NavigateUrl = "~/Sitefinity/UserControls/Dialogs/ImageEditorDialog.aspx"
                    window.Width = Unit.Point(750); 
                    window.Height = Unit.Point(515); 
                    window.VisibleOnPageLoad = false
                    window.ClientCallBackFunction = "CallBackFunction"
                    manager.Windows.Add(window); 
                } 
            } 
        } 
    }  
     

    Let us know if this helps you for your user control.

    Best wishes,

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
3 posts, 0 answered