I have a simple composite control with the following attributes:
[
Bindable(true),
Category("Appearance"),
DefaultValue("Enter name:"),
Description("The text for the name label.")
]
public string NameLabelText
{
get
{
EnsureChildControls();
return nameLabel.Text;
}
set
{
EnsureChildControls();
nameLabel.Text = value;
}
}
However, when I drop the control on the page, the property is NOT set
to the DefaultValue. It is blank.
Can someone help me and explain why the default value doesn't work?
Thanks
J
Christoph Richter [AT] - 14 Jun 2006 20:56 GMT
That behaviour is per default.
all Standard classes have an if(value == null) implemented to catch
that.
the default value is for the Designer. so if you see the Properties of
your dropped control(normally in the lower right pane), you see there
the default values, that don't need to be set (so you have an code
that is easier to read)
cheers
christoph
>I have a simple composite control with the following attributes:
>
[quoted text clipped - 25 lines]
>
>J