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

Forums / Developing with Sitefinity / Ordering of Custom Control Properties

Ordering of Custom Control Properties

6 posts, 0 answered
  1. Lee
    Lee avatar
    13 posts
    Registered:
    15 Aug 2008
    15 Aug 2008
    Link to this post
    Hi all,

    I hope someone can help as I'm sure this is quite simple.

    I have a custom control which I have added a couple of properties to

    [Browsable(true)]

    [Category("Answers")]

    [DisplayName("Answer 1")]

    public string Answer1

    {

    get { return _answer1; }

    set { _answer1 = value; }

    }

    [Browsable(true)]

    [Category("Answers")]

    [DisplayName("Answer 2")]

    public string Answer2

    {

    get { return _answer2; }

    set { _answer2 = value; }

    }

    [Browsable(true)]

    [Category("Answers")]

    [DisplayName("Answer 3")]

    public string Answer3

    {

    get { return _answer3; }

    set { _answer3 = value; }

    }

    [Browsable(true)]

    [Category("Answers")]

    [DisplayName("Answer 4")]

    public string Answer4

    {

    get { return _answer4; }

    set { _answer4 = value; }

    }

    [Browsable(true)]

    [Category("Answers")]

    [DisplayName("Answer 5")]

    public string Answer5

    {

    get { return _answer5; }

    set { _answer5 = value; }

    }

    However, when editing the properties of this control in sitefinity the order of the properties are
    Answer 3
    Answer 2
    Answer 5
    Answer 4
    Answer 1

    Is there an attribute that I am missing to force the order or something that I'm not doing right?

    Many thanks in advance

    Lee

  2. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    18 Aug 2008
    Link to this post
    Hello Lee,

    This seems to be a bug that we haven't encountered so far. That is why we updated your Telerik account. The issue will be fixed for the next release. Unfortunately, we would not be able to provide a workaround for it.
     
    Please excuse us for the inconvenience.


    Best wishes,
    Sonya
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Slawek
    Slawek avatar
    16 posts
    Registered:
    16 Feb 2009
    07 Oct 2009
    Link to this post
    Hi,

    I have the same problem I'm using Sitefinity 3.6 and have 8 pairs of text fields named Image1 .. Image8, Image1alt .. Image8alt and they are displayed in random order. I need to have them in pairs in ascending order. Has this been solved yet?

    Cheers,
    Slawek
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    07 Oct 2009
    Link to this post
    Hello Slawek,

    The problem is not fixed in the last official release. It it related to Sitefinity's ControlDesigner. Generally the properties cannot be ordered. The problem will be fixed for Sitefinity 4.0. We are sorry for the inconvenience caused.

    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.
  5. Slawek
    Slawek avatar
    16 posts
    Registered:
    16 Feb 2009
    20 Oct 2009
    Link to this post
    Hi all,

    I've sorted this out by implementing control designer (http://www.sitefinitywatch.com/blog/09-02-20/Making_Control_Editing_User-Friendly_with_Sitefinity_Control_Designers.aspx) which took quite a bit longer than if the controls show up in the same order I declare them.

    Anyway it works now I was just wondering if in control designer I have to declare all variables I want separately or could I declare an array of strings? It looks like this now:

        public string Image_1_File_Name { get; set; }
        public string Image_1_Alt_Tag { get; set; }

        public string Image_2_File_Name { get; set; }
        public string Image_2_Alt_Tag { get; set; }
       ...........................
        public string Image_x_File_Name { get; set; }
        public string Image_x_Alt_Tag { get; set; }

    Then in product gallery I have this times 8:

    if (String.IsNullOrEmpty(Image_1_File_Name) == true) {
                Image1_ph.Visible = false;
            }
            else {        
            productImageLink1.NavigateUrl = Folder_URL + Image_1_File_Name + "_l.jpg";
            productImageLink1.Attributes.Add("rel", "zoom-id:"+ zoom.ClientID +";zoom-fade: true");
            productImageLink1.Attributes.Add("rev", Folder_URL + Image_1_File_Name + "_m.jpg");
            productImage1.ImageUrl = Folder_URL + Image_1_File_Name + "_tn.jpg";
            productImage1.AlternateText = Image_1_Alt_Tag;
            }
    And a few more times same thing repeated times 8.

    Would this work on arrays or in a loop? productImageLink1 is the ID of image control in my productGallery.ascx

    <asp:PlaceHolder ID="Image1_ph" runat="server">
        <asp:HyperLink id="productImageLink1"
                              NavigateUrl=""                         
                              runat="server">
                              <asp:Image id="productImage1"
                            runat="server"
                            AlternateText=""
                            Style="margin-right:5px"
                            ImageUrl=""/>
         </asp:HyperLink>
    </asp:PlaceHolder>

    It's quite complicated so I wanted to make it better by looping through arrays but will control designer recognize for example:
     public string Image_File_Name[8] { get; set; }
    and will it show 8 textboxes to input values?

    Any suggestions are welcome,
    S.
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    23 Oct 2009
    Link to this post
    Hi Slawek,

    You would be able to use enumerations for properties or use a string of array, for properties. However the control designer will not recognize this. You will have to dynamically add the controls on page load based on the size of the array using this.Controls.Add() and add appropriate controls to the interface of the designer. However I think that currently you are using the most error proof approach. In fact in our control designers we are manually exposing all properties that can be publicly set.

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