usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Text;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
namespace WebCustomControl1
{
[DefaultProperty('Text')]
[ToolboxData('<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>')]
public class WebCustomControl1 : WebControl
{
[Bindable(true)]
[Category('Appearance')]
[DefaultValue('')]
[Localizable(true)]
public string Text
{
get
{
String s = (String)ViewState['Text'];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState['Text'] = value;
}
}
protected override void CreateChildControls()
{
CheckBox blah = new CheckBox();
blah.Text = 'CheckText';
blah.ID = 'CheckValue';
this.Controls.Add(blah);
}
protected override void RenderContents(HtmlTextWriter writer)
{
this.EnsureChildControls();
this.RenderChildren(writer);
}
}
}
Share with