I have a problem with the default value attribute.
When I add my control to page at design mode, default value does not work. This is my code:
[DefaultProperty("Text")]
[ToolboxData("<{0}:KHTLabel runat=server key=dfd></{0}:KHTLabel>")]
public class KHTLabel : Label ,IKHTBaseControl
{
[Bindable(true)]
[Category("Appearance")]
[DefaultValue("KHT")]
[Localizable(true)]
public string Key
{
get
{
String s = (String)ViewState["Key"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Key"] = value;
}
}
protected override void RenderContents(HtmlTextWriter writer)
{......
But, at design mode when I add a control from the toolbox, the key does not exist
<cc1:KHTLabel ID="KHTLabel1" runat="server"></cc1:KHTLabel>