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

Forums / Developing with Sitefinity / Adding ImageUrl property to user control

Adding ImageUrl property to user control

12 posts, 0 answered
  1. Nick
    Nick avatar
    14 posts
    Registered:
    30 Jun 2006
    27 Sep 2007
    Link to this post

    I would like to add an ImageUrl property (as used in the Image user control) to a user control i am writting.  I have seen a post that does something similar with the UrlEditorWrapper as seen in the code below but was wondering how this would be implemented for files (rather than the sitemap).

    private String imageUrl;

    [WebEditor("Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms")]

    public String ImageUrl

    {

    set

    {

    imageUrl = value;

    }

    get

    {

    return imageUrl;

    }

    }

  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    27 Sep 2007
    Link to this post
    Hello Nick,

    You could achieve this as follows:

    [WebEditor("Telerik.FileManager.UrlWebEditor, Telerik.FileManager")] 
            public string ImageUrl 
            { 
                get 
                { 
                    return this.imageUrl; 
                } 
                set 
                { 
                    this.imageUrl = value
                } 
            } 

    Hope this helps.

    Best wishes,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Nick
    Nick avatar
    14 posts
    Registered:
    30 Jun 2006
    27 Sep 2007
    Link to this post
    Hi Pepi,

    Thats just what i was looking for, is there anywhere things like this are listed?



    Many thanks
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    27 Sep 2007
    Link to this post
    Hello Nick,

    Here is the list with the existing selectors:

    <WebEditor("Telerik.Blogs.WebControls.BlogsSelector, Telerik.Blogs")>   
               
    <WebEditor("Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms") 
      
    <WebEditor("Telerik.Cms.Engine.WebControls.Categories.CategoriesSelector, Telerik.Cms.Engine")>   
               
    <WebEditor("Telerik.Cms.Engine.WebControls.ContentSelector, Telerik.Cms.Engine")>   
      
    <WebEditor("Telerik.Cms.Web.UI.CmsHyperLinkUrlWebEditor, Telerik.Cms") 
               
    <WebEditor("Telerik.Cms.Engine.WebControls.SelectContentDialog, Telerik.Cms.Engine")>   
               
    <WebEditor("Telerik.Cms.Engine.WebControls.HtmlContentEditor, Telerik.Cms.Engine")>   
               
    <WebEditor("Telerik.Cms.Engine.WebControls.RssContentSelector, Telerik.Cms.Engine")>   
      
    <WebEditor("Telerik.Cms.Web.UI.CmsUrlWebEditor, Telerik.Cms")>           
      
    <WebEditor("Telerik.Lists.WebControls.ListSelector, Telerik.Lists")>   

    And now some explanation:

    * BlogsSelector: This class represents a control that let's user choose one or more different blogs.

    * CategoriesSelector: Represents a control that let's user choose categories.

    * ContentSelector: Represents control for selecting generic content.

    * ListSelector: Control used for selecting lists.

    * RssContentSelector: Represents control for selecting rss feeds.

    * CmsUrlWebEditor: Represents control for selecting pages from the site map. Returns the Url of the page.

    * CmsHyperLinkUrlWebEditor: Represents control for selecting pages from the site map. Returns the ID of the page.

    * HtmlContentEditor: Inherits WebUITypeEditor abstract class and represents custom editor for Html content.

    * SelectContentDialog: Represents dialog for selecting content.

    * UrlEditorWrapper: Represents control for selecting a page from the site map or a file from the file system. If page is selected returns the ID of that page.

    Sincerely yours,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Nick
    Nick avatar
    14 posts
    Registered:
    30 Jun 2006
    27 Sep 2007
    Link to this post
    Thanks again Pepi
  6. Darchele
    Darchele avatar
    24 posts
    Registered:
    08 Sep 2006
    16 Oct 2008
    Link to this post
    Is there an existing selector for selecting images from an image library?
  7. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    16 Oct 2008
    Link to this post
    Hello Darchele,

    You need to mark your property with the following attribute:

    [WebEditor("Telerik.Libraries.WebControls.ImageSelector, Telerik.Libraries")]  

    Hope this helps.

    Kind regards,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. jas4on
    jas4on avatar
    11 posts
    Registered:
    07 Aug 2009
    08 Jan 2010
    Link to this post
    I'm attempting to use Telerik.Lists.WebControls.ListSelector, Telerik.Lists to display lists but I keep getting an "Object reference not set to an instance of an object" error yet in the same usercontrol I'm successfully using Telerik.Libraries.WebControls.ImageSelector, Telerik.Libraries to display image libraries.  What am I missing....a reference?  Using SF3.5

             
    ...
             [Telerik.Cms.Web.UI.WebEditor("Telerik.Lists.WebControls.ListSelector, Telerik.Lists")] 
            public string strVideoUrl 
            { 
                get 
                { 
                       return _strVideoUrl; 
                } 
                set { _strVideoUrl = value; } 
            } 
     
            private string _strSplashImage; 
            [Telerik.Cms.Web.UI.WebEditor("Telerik.Libraries.WebControls.ImageSelector, Telerik.Libraries")] 
            public string strSplashImage 
            { 
                get 
                {... 


    Thanks!


  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Jan 2010
    Link to this post
    Hi jas4on,

    You are missing several things, but the important one is that your control should implement Telerik.Lists.IListDisplay. The second thing is that this selector returns guid, not string.

    Below is the correct implementation

    public partial class MyControl : System.Web.UI.UserControl, Telerik.Lists.IListDisplay
    {
     
        [TypeConverter("Telerik.Lists.WebControls.ListsIdsConverter, Telerik.Lists")]
        [WebEditor("Telerik.Lists.WebControls.ListSelector, Telerik.Lists")]
        public Guid[] ListsIds
        {
            get { return this.ids; }
            set { this.ids = value; }
        }
     
        public string ProviderName
        {
            get
            {
                if (String.IsNullOrEmpty(this.providerName))
                    this.providerName = ListManager.DefaultProviderName;
                return this.providerName;
            }
            set
            {
                this.providerName = value;
            }
        }
        private string providerName;
        private Guid[] ids;
     
    }

     

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. jas4on
    jas4on avatar
    11 posts
    Registered:
    07 Aug 2009
    08 Jan 2010
    Link to this post
    Found answer here:

    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/telerik-lists-webcontrols-listselector-object-reference-not-set-to-an-instance-of-an-object.aspx

    But as it turns out, this isn't the functionality I was looking for.  How do I allow a user to select and *item* from a list instead of the whole list?  Similar to the image selector, I would like users to be allowed to select a list and then an item OR, ideally, set the list for them to select an item from.  Can someone give me some ideas or hints in that direction?

    thanks
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Jan 2010
    Link to this post
    Hello jas4on,

    You have to create a custom WebUITypeEditor with the proper control for selecting desired items. You can take a look at the following blog post

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  12. jas4on
    jas4on avatar
    11 posts
    Registered:
    07 Aug 2009
    08 Jan 2010
    Link to this post
    Thank you for the very prompt responses..... now I'll get to work creating my custom WebUITypeEditor.
Register for webinar
12 posts, 0 answered