If you make your usercontrol inherit from System.Web.UI.WebControls.WebControl
, then you can override the height and width properties, and do nothing in the setter.
So i created a new control, called it zzz
, and changed its inheritance from System.Web.UI.UserControl to System.Web.UI.WebControls.WebControl. After that, this is what my code behind looks like:
public partial class zzz : WebControl
{
public zzz()
{
base.Height = new Unit(100, UnitType.Pixel);
base.Width = new Unit(150, UnitType.Pixel);
}
public override Unit Height
{
get { return base.Height; }
set { }
}
public override Unit Width
{
get { return base.Width; }
set { }
}
}