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

Forums / Developing with Sitefinity / Passing values from Designer to SimpleControl

Passing values from Designer to SimpleControl

5 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    21 Sep 2009
    Link to this post
    Hi team,

    I need to pass some public values from my Designer Base (Base and ControlDesigner) to my UserControl implementing SimpleControl in place of Designer Base.
    Normally if you make inherit the control the base of Designer is very easier but in the case of you need to implement SimpleControl i can't cast the public values from the Base. Could you sugest the way?.
    Could you found some simple case implementing SimpleControl with a basic designer?.

    regards.

    the Base  
     
    [Telerik.Framework.Web.Design.ControlDesigner("ControlDesigner, MyControls.Web.UI")]  
    public class ControlBase : System.Web.UI.UserControl  
    {  
     
     public string usingProvider{get;set;}.....  
     
    --------  
    the control Designer  
    public class ControlDesigner : Telerik.Framework.Web.Design.ControlDesigner  
    {  
       public ControlDesigner()  
       {  
       }  
     
     
    --------  
    My CustomControl implementing SimpleControl  
     [Telerik.Framework.Web.Design.ControlDesigner("Vistainmo.Web.UI.WebUIDesigner")]  
     class MyCustmControls : SimpleControl  
     {  
     ....
            ((ControlBase)DesignedControl).usingProvider;  <--NOT CASTING 
      ....
     
      
     


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Sep 2009
    Link to this post
    Hello Pierre,

    You cannot set the value using a control that inherits from System.Web.UI.UserControl. Create a custom control that inherits from WebControl or Simple control and then pass the 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. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    21 Sep 2009
    Link to this post
    Hi Ivan,

    I have tried with no success. I have implemented my designer base as WebControls and after as SimpleControl and tried to cast one public value in my SimpleControl but I don´t fount the good method. Could you help me with more explicit answer please.
    My object is bee able to cast  the provider name value defined in the control base of designer to use them in
    my UserControl building one dataset of items before render.

    object :Passing public values from Designer: (BaseDesigner-->ControlDesigner-->SimpleControl)

    BaseDesigner to ControlDesigner like: ((BaseDesigner)DesignedControl).mypublic is Cast OK
    BaseDesigner to MySimpleControl like ? or
    ControlDesigner to MySimpleControl like ?
    BaseDesigner implemented as WebControl or SimpleControl same issue
    Casted value defined as public string with get; and set;.

    Regards
  4. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    24 Sep 2009
    Link to this post
    Hi Team,

    I need some complemetary help to pass my values from Designer to the SimpleControl public properties.  I have simplified my solution. One designer to one simpleControl. I try to pass the values from designer but not fire the public properties from designer or during initialize of SimpleControl. All values are stored in session states and are here after postback,  using strings same issue. The only way is set manually in Advanced Mode the values!?. Could you help me with one simple designer passing one value to the SimpleControl.

    1/DURING ONSAVING OR CREATING CHILDCONTROLS IN DESIGNER 
    public class WebUIDesigner : Telerik.Framework.Web.Design.ControlDesigner 
        { 
     
            public WebUIDesigner() 
            { 
            } 
        ... 
        protected override void CreateChildControls() 
            { 
                base.CreateChildControls();  
            VistaControls MyBase = (VistaControls)base.DesignedControl; 
            MyBase.Provider="News"; //<--NOT FIRE 
                 ....
         
        public override OnSaving() 
        { 
            //Cast my simpleControl 
            VistaControls MyBase = (VistaControls)base.DesignedControl; 
            MyBase.Provider="News"; //<-- NOT FIRE 
        } 
     
     
    SIMPLECONTROL 
    public class VistaControls:SimpleControls 
        public string Provider{get;set;} 
     
     
    2 TRIED DURING INITIALIZE EVENT of SImpleControl . NOT FIRE  
         
        protected override void InitializeControls(Control controlContainer) 
            { 
                base.InitializeControls(controlContainer); 
                WebUIDesigner MyBase = new WebUIDesigner(); 
                this.Provider = MyBase.MyProvider.Text;//News 

    I have watched many times the Sitefinitywatch tutorial and woks fine for simple userControls but I not able to use SimpleControls.

    Regard

  5. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    25 Sep 2009
    Link to this post
    Hi,

    Solved. It´s one problem between the dll and similar code in App_Code folder for debug needs. The classes names using same namespaces. I apologize.
Register for webinar
5 posts, 0 answered