这两天写了个web自定义控件,控件由一个TextBox、一个Button、一个Calendar构成。但不知道怎么给加个智能标记,智能标记是用来选择Calendar样式的。希望得到指点,谢谢!
下面是控件代码:
[Designer(typeof(DateSelectDesignerActionList))]
[DefaultProperty( "EnableMultiSelect ")]
[ToolboxBitmap(typeof(DateTextBox), "ToolIcon.DateSelect.bmp ")]
[ToolboxData( " <{0}:DateSelect runat=server> </{0}:DateSelect> ")]
public class DateSelect : WebControl, INamingContainer, IComponent
{
private TextBox txtDateTime;
private Button btnSelect;
private Calendar calDateTime;
public DateSelect()
{
InitializeComponent();
}
public void InitializeComponent()
{
CreateComponent();
SetComponentProperty();
SetComponentEvent();
}
public void CreateComponent()
{
// Create Control
txtDateTime = new TextBox();
btnSelect = new Button();
calDateTime = new Calendar();
// Nest Control
Controls.Add(txtDateTime);
Controls.Add(btnSelect);
Controls.Add(calDateTime);
}
public void SetComponentProperty()
{
btnSelect.Text = "选择 ";
calDateTime.Visible = false;
calDateTime.Font.Name = "Verdana ";