Using C# for a web application we run into the following problem:<BR><BR>We want to create a web component that has a property of control type e.g. Textbox. At design time on the component we can set the property to one of the controls on the form. But when we run the code and have a statement that uses the control it is null. <BR><BR>How can we overcome this problem? Attached is a code that demonstrates the problem.<BR><BR>In other words: <BR><BR>We want to make a web component (oeButton) whose property (oeSourceTextBox) is of type TextBox. At design time oeSourceTextBox property is populated with ID&#039;s of all the TextBoxes available on the form. And we can select any one TextBox from the dropdown list.<BR><BR>The component (oeButton) inherits web Button control. What we are trying to do is that at run time when the user will click on oeButton its Text should change to oeSourceTextBox.Text<BR><BR><BR>In the Test web Project I added 2 TextBoxes with Text as TB1 and TB2, and 1 oeButton.oeSourceTextBox property of oeButton is populated with ID&#039;s of TextBox1 and TextBox2.I set oeSourceTextBox = TextBox2. When I run the project and then click on oeButton nothing happens because in OnClick event (this.SourceTextBox != null) returns False.<BR>How to Fix this?<BR><BR><BR>Here is class oeButton:<BR><BR>using System;<BR>using System.Web.UI;<BR>using System.Web.UI.WebControls;<BR>using System.ComponentModel;<BR><BR>namespace TestComponent<BR>{<BR>[DefaultProperty("Text"),<BR>ToolboxData("&#060;{0} :oeButton runat=server&#062;&#060;/{0}:oeButton&#062;")]<BR>public class oeButton : System.Web.UI.WebControls.Button <BR>//=============================================<BR>{ <BR><BR>private TextBox SourceTextBox;<BR>[Bindable(true),<BR>Category("oe"),<BR>DefaultValue ("")]<BR>public TextBox oeSourceTextBox<BR>//===============================================<BR >{<BR>get<BR>{<BR>return SourceTextBox;<BR>}<BR>set<BR>{<BR>SourceTextBox = value;<BR>}<BR>}<BR><BR>protected override void Render(HtmlTextWriter output)<BR>//===============================================<BR >{<BR>base.Render(output); <BR>}<BR><BR><BR>protected override void OnClick(EventArgs e)<BR>//==========================================<BR>{<BR >if (this.SourceTextBox != null)<BR>{<BR>this.Text = this.SourceTextBox.Text; <BR>}<BR>}<BR><BR>}<BR>}<BR><BR>