Exposing a control through a property
-
Hello everyone. I have an interesting problem that I need help with. I'm sure someone else has already had this problem. I have a custom control (either win or web because I have both doing this) and this control contains other controls such as a label and richtextbox. Well I have a few public properties that set properties on the internal controls but I also have a property that exposes the internal control as a property. My problem is that when I goto the designer and set properties though the control exposed though the property none of the settings are kept, however if I set the properties on the exposed control in code behind everything works fine. Any help would be apprciated -Richard
-
Hello everyone. I have an interesting problem that I need help with. I'm sure someone else has already had this problem. I have a custom control (either win or web because I have both doing this) and this control contains other controls such as a label and richtextbox. Well I have a few public properties that set properties on the internal controls but I also have a property that exposes the internal control as a property. My problem is that when I goto the designer and set properties though the control exposed though the property none of the settings are kept, however if I set the properties on the exposed control in code behind everything works fine. Any help would be apprciated -Richard
-
Hello everyone. I have an interesting problem that I need help with. I'm sure someone else has already had this problem. I have a custom control (either win or web because I have both doing this) and this control contains other controls such as a label and richtextbox. Well I have a few public properties that set properties on the internal controls but I also have a property that exposes the internal control as a property. My problem is that when I goto the designer and set properties though the control exposed though the property none of the settings are kept, however if I set the properties on the exposed control in code behind everything works fine. Any help would be apprciated -Richard
if u have custom properties on that control property, be sure to use [DefaultValue(false)] on the properties if they are primitive types (int,string etc.). If u have object properties use the [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] attribute and go into that object and use the [DefaultValue(false)] attribute. etc. etc.