textbox与Calendar的绑定

protected void Page_Load(object sender, EventArgs e)
    {
        this.Calendar1.Attributes.Add("style", "display:none;border-width:1px;border-style:solid;border-collapse:collapse;z-index: 100; left: 0px;");
        TextBox1.Attributes.Add("onfocus", "javascript:document.getElementById('Calendar1').style.display=''");
    }
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        TextBox1.Text = this.Calendar1.SelectedDate.ToShortDateString();
        Calendar1.Attributes.Add("onblur", "javascript:document.getElementById('Calendar1').style.display='none'");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Console.Write(this.TextBox1.Text);

你可能感兴趣的:(textbox与Calendar的绑定)