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

Forums / Developing with Sitefinity / CmsUrlWebEditor in a Custom Control Property Designer

CmsUrlWebEditor in a Custom Control Property Designer

6 posts, 1 answered
  1. Jon Roberts
    Jon Roberts avatar
    3 posts
    Registered:
    14 May 2009
    24 Sep 2009
    Link to this post
    Hello,

    I have created a control that will utilize a custom property control designer.  How would I go about adding a CmsUrlWebEditor to the custom designer so that the user can select pages from the page selector dialog?  I understand that I can add an attribute to a public proberty for a simple control (see this post) and utililize the page selector dialog, but I have not figured out how to do this when my control has a custom property designer.  Any information would be greatly appreciated.

    Regards,
    Drew
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Sep 2009
    Link to this post
    Hi Drew engelmeyer,

    It is possible. In the WebEditor template you can use LinkButton or ButtonSelector control. Then need to create a new object of PropertyEditorDialog and show the page selector inside the dialog. Below is a sample code:

     protected void Page_Load(object sender, EventArgs e) 
        { 
     
            this.Dialog = new PropertyEditorDialog(); 
            this.Dialog.TypeContainer = this
            this.Dialog.PropertyChanged += new PropertyValueChangedEventHandler(editorDialog_PropertyChanged); 
            this.Controls.Add(this.editorDialog); 
     
            this.urlPicker.CommandName = "Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms"
            this.urlPicker.CommandArgument = "Node"
            this.urlPicker.Command += new CommandEventHandler(urlPicker_Command); 
        } 
     
        void editorDialog_PropertyChanged(object source, PropertyValueChangedEventArgs e) 
        { 
         // add logic here.    
        } 
     
        void urlPicker_Command(object sender, CommandEventArgs e) 
        { 
            string name = (string)e.CommandArgument; 
            this.Dialog.Show(name, e.CommandName); 
        } 
        private PropertyEditorDialog Dialog; 

    I hope this helps.

    Kind regards,
    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.
  3. Jon Roberts
    Jon Roberts avatar
    3 posts
    Registered:
    14 May 2009
    25 Sep 2009
    Link to this post
    Hey Ivan,

    Thanks for the quick response.  Unfortunately, the code you provided was not what I was looking for.  I'm pretty sure it was my fault for not thoroughly explaining what I wanted.  All I really wanted was a PagesSelector in my customer property designer.  I led you down the wrong track when I referenced the CmsUrlWebEditor.  Anyway, I did manage to figure it out.  For anyone else looking to do this, below is the code that I used.

     

    <%@ Register TagPrefix="TelerikLib" Namespace="Telerik.Libraries.WebControls" Assembly="Telerik.Libraries" %>   
     
    <asp:TextBox ID="txtHeaderNavigateUrl" Text="" runat="server" Width="200px"></asp:TextBox>   
    <telerikLib:ButtonSelector   
    WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/PagesSelector.aspx"   
    AssociatedControls="txtHeaderNavigateUrl"   
    runat="server"   
    CssClass="imagePicker"   
    ButtonText="Select" /> 
     
     


    Thanks again for your quick response,
    Drew

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Sep 2009
    Link to this post
    Hello Drew engelmeyer,

    The code I sent you will do the same thing. It is useful when you work with WebUITypeEditor and multiple selectors.

    Kind regards,
    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.
    Answered
  5. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    17 Jul 2010
    Link to this post
    drew,

    I tried your code on one of my own custom control designers, and while the selector button does show up, clicking on it does nothing.

    is there anything missing from your code example or any other steps you have to do to enable this page picker control?

    thanks!
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    18 Jul 2010
    Link to this post
    Hello SelArom,

    I have send you a reply in your support request.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 1 answered