I'm just getting started with creating my own ASP.Net server controls. Right now, I'm creating a composite control based off the ASP.Net button control. It is working great and doing exactly what I want it to do, but I noticed that setting the width property
in the property browser had no affect on the width so I added this code to my code for the control:
public override Unit Width
{
get
{
return base.Width;
}
set
{
EnsureChildControls();
base.Width = value;
btnSubmit.Width = value;
}
}
I'm wondering why I have to do this? Is there a better way? I wanted the width property to work, so I played with this until it worked, but I noticed many other properties (ie BackColor) that aren't working. I can set the value in the property browser,
but it has no affect on the button inside my custom control and I'm just trying to figure out the best way to have these default property values work.
delta
Member
74 Points
44 Posts
default property values not applying
Nov 27, 2006 06:38 PM|LINK
Hi,
I'm just getting started with creating my own ASP.Net server controls. Right now, I'm creating a composite control based off the ASP.Net button control. It is working great and doing exactly what I want it to do, but I noticed that setting the width property in the property browser had no affect on the width so I added this code to my code for the control:
public override Unit Width { get { return base.Width; } set { EnsureChildControls(); base.Width = value; btnSubmit.Width = value; } }I'm wondering why I have to do this? Is there a better way? I wanted the width property to work, so I played with this until it worked, but I noticed many other properties (ie BackColor) that aren't working. I can set the value in the property browser, but it has no affect on the button inside my custom control and I'm just trying to figure out the best way to have these default property values work.
Thanks
Chad