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

Forums / Developing with Sitefinity / How to add options to panel edit - User Control

How to add options to panel edit - User Control

4 posts, 0 answered
  1. Ruben Herrera
    Ruben Herrera avatar
    38 posts
    Registered:
    10 Jul 2009
    08 Sep 2009
    Link to this post
    Hi, I have an User Control that paint navigation menu.

    I need to set some bool variables in panel edit but I don´t know how to do that.

    I have this one to select starting node:

    [WebEditor("Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms")] 
        [Browsable(true)] 
        [Category("Navigation")] 
        public string StartingNodeUrl 
        { 
            get 
            { 
                return startingNodeUrl ?? ""; 
            } 
            set 
            { 
                startingNodeUrl = value ?? ""; 
                 
            } 
        } 

    And I can see in Navigation section. I want to add another like this:

    DoSomething -- select box with Yes or Not like Visible option.

    Regards
    Rubén

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Sep 2009
    Link to this post
    Hello Ruben Herrera,

    Below is a sample code that illustrates the desired behavior.

         public enum Value { Yes, No }; 
         public Value MyValue 
         { 
             get 
             { 
                 object obj = this.ViewState["Values"]; 
                 if (obj != null
                     return (Value)obj; 
                 return Value.Yes; 
             } 
             set 
             { 
                 this.ViewState["Values"] = value; 
             } 
         } 


    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. Ruben Herrera
    Ruben Herrera avatar
    38 posts
    Registered:
    10 Jul 2009
    08 Sep 2009
    Link to this post
    Thanks!!

    I get it with this:
     [Category("Navegacion")] 
        public bool ExpandirTodosNodos 
        { 
            get 
            { 
                return _expandirTodosNodos; 
            } 
            set 
            { 
                _expandirTodosNodos = value
            } 
        } 
     


    Best wishes!
    Rubén
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Sep 2009
    Link to this post
    Hello Ruben Herrera,

    Yes, this is a Boolean type property. Additionally you can add  [DefaultValue(false)] attribute - so you can set it to false or true by default.

    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
4 posts, 0 answered