G
Guest
I try to add a textbox from code of my custom component laid on the web form.
It appears in the code behind but not in the designer; moreover when I switch
from design to html view it gets removed from the code-behind.
What interesting: when (by mistake) I tried to add Windows TextBox the code
added it to the component section of the designer (so "almost" desired
behaviour...)
Any ideas, please?
The code is based on MSDN example of component
ms-help://MS.VSCC.2003/MS.MSDNQTR.2004OCT.1033/cpref/html/frlrfSystemComponentModelDesignIDesignerHostClassTopic.htm
- I'm trying this code when user double-clicks component
IDesignerHost host =
(IDesignerHost)this.component.Site.GetService(typeof(IDesignerHost));
IComponent newItem =
host.CreateComponent(typeof(System.Web.UI.WebControls.TextBox), "txtNew");
//when this code used, works
//IComponent newItem =
host.CreateComponent(typeof(System.Windows.Forms.TextBox), "txtNew");
It appears in the code behind but not in the designer; moreover when I switch
from design to html view it gets removed from the code-behind.
What interesting: when (by mistake) I tried to add Windows TextBox the code
added it to the component section of the designer (so "almost" desired
behaviour...)
Any ideas, please?
The code is based on MSDN example of component
ms-help://MS.VSCC.2003/MS.MSDNQTR.2004OCT.1033/cpref/html/frlrfSystemComponentModelDesignIDesignerHostClassTopic.htm
- I'm trying this code when user double-clicks component
IDesignerHost host =
(IDesignerHost)this.component.Site.GetService(typeof(IDesignerHost));
IComponent newItem =
host.CreateComponent(typeof(System.Web.UI.WebControls.TextBox), "txtNew");
//when this code used, works
//IComponent newItem =
host.CreateComponent(typeof(System.Windows.Forms.TextBox), "txtNew");