1. either write a custom ControlDesigner class and implement GetDesignTimeHtml method or write add a check in your code:public TextBoxCalendar()
{
if (Context == null)
EnsureChildControls();
}2. write a custom ControlDesigner class and implement OnControlResize method or derive your class from WebControl and override Width/Height properties to resize your TextBox
{
if (Context == null)
EnsureChildControls();
}2. write a custom ControlDesigner class and implement OnControlResize method or derive your class from WebControl and override Width/Height properties to resize your TextBox
public class TextBoxCalendar: WebControl
{
TextBox tbx;
Image img;
public TextBoxCalendar()
{
if (Context == null)
EnsureChildControls();
}
protected override void CreateChildControls()
{
tbx = new TextBox();
img = new Image();
img.ImageUrl = "http://groups.google.com/images/res1.gif";
img.Attributes.Add("onclick","calendar()");
this.Controls.Add( tbx );
this.Controls.Add( img );
} public override Unit Width
{
get
{
return base.Width;
}
set
{
base.Width = value;
EnsureChildControls();
tbx.Width = Width;
}
} public override Unit Height
{
get
{
return base.Height;
}
set
{
base.Height = value;
EnsureChildControls();
tbx.Height = Unit.Pixel((int)Height.Value - 20);
}
}
}