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

Forums / Developing with Sitefinity / richer user controls?

richer user controls?

8 posts, 0 answered
  1. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    11 Nov 2009
    Link to this post
    Hi

    I've created quite a few user controls which allows you to edit the properties etc
    however, i want to start creating more user rich user controls much like the newsView control


    i've also been stumped by the order the properties (when editing them) are displayed
    i.e. - if you create a simple emailform control, and have properties you edit to configure mailserver etc, they are displayed in a random order!
    so to summarise:
    1) How do i control the order of the properties you see when editing a control?
    2) Can i hide public properties
    3) can i have dropdowns in this screen?
    4) can i create a my own UI ?

    Thanks
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Nov 2009
    Link to this post
    Hi Quade,

    Thank you for using our services.

    For the purpose of building more complex controls I would suggest developing custom controls instaed of user controls. This will allow you to build control designers, which have your own defined look and feel, and develop control templates for different presentation modes. A good starter on the topic is the following webinar - Creating Highly Usable & Distributable Sitefinity Controls. You should also take a look at the following tutorial - Implementing Control Designers. Now to your questions.

    1) How do i control the order of the properties you see when editing a control?
    Take a look at the following forum thread - Ordering of Custom Control Properties. Basically this is not available. This will be available in Sf4

    2) Can i hide public properties

    If you do not expose public get and set methods for the properties they will not be available for edit in the UI.

    3) can i have dropdowns in this screen?
    Dropdowns are vailable in custom control desginers. If you wish to use dropdowns in Properties->Advanced tab you should use Enum or a WebEditor. You can check out Ivan Dimitrov's Blog for samples on WebEditors.

    4) can i create a my own UI ?
    Can you be more specific with this question? Can you create your own UI for what - the control editor or the public presentation? If the first case see what I wrote about control designers. If the second case this I think that you can guess the answer.

    Regards,
    Radoslav Georgiev
    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. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    11 Nov 2009
    Link to this post
    Hi All

    Just looking at this thread.
    I'm interested in separating the presentation HTML from the code in a custom control (as you would in a user control) Had a look around and can't see how to implement, can I have an .ascx file in my custom control class?
    I have seen the stuff on control designers but these are for editing only it seems...?

    Sorry if this is an obvious question! Just getting into Custom Controls

    Matt
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Nov 2009
    Link to this post
    Hi mattc,

    Your custom control will point to a control template. Please take a look at Using Templates in Custom Sitefinity Controls

    All the best,
    Radoslav Georgiev
    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.
  5. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    11 Nov 2009
    Link to this post
    Hi Radoslav

    Perfect! Exactly the functionality I hoped for! Thanks

    Matt
  6. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    11 Nov 2009
    Link to this post
    Hello

    Looking at this it works fine setting properties of controls in the template. If I put a button control in the template, I'm assuming I can hook up the onClick event to my class? If so how would I do that please?

    Thanks
  7. mattc
    mattc avatar
    105 posts
    Registered:
    11 Aug 2007
    11 Nov 2009
    Link to this post
    hello

    achieved this by the following:
     protected virtual Button formButton 
            { 
                get 
                { 
                    return base.Container.GetControl<Button>("Button1", true); 
                } 
            } 

    and then adding an event handler in the InitializeControls()

    formButton.Click += new System.EventHandler(clickEvent); 

    and adding the clickEvent

    void clickEvent(object sender, EventArgs e) 
            { 
                //do stuff 
            } 

    This seems to work. Is the best way?

    Thanks
    Matt
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    11 Nov 2009
    Link to this post
    Hi mattc,

    You have used the correct way - control reference to the control and then subscribing for button.click event.

    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.
Register for webinar
8 posts, 0 answered