使用C#弹出.NET日历

时间:2015-07-01 16:32:25

标签: c# .net calendar

如果选择日期而不是再次选择按钮,如何使.NET中的日历最小化? 现在,当我按下按钮时,我的日历最小化。我希望它能在我点击日期后尽量减少,以使我的网站更有效率。 到目前为止这是我的代码。非常感谢

 protected void Cal1_SelectionChanged(object sender, EventArgs e)
    {
       // TextBox1.Text = Convert.ToString(Cal1.SelectedDate);//For full length date and time
        TextBox1.Text = Cal1.SelectedDate.ToShortDateString();//Shorter version of date selection
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
         * set calender to hidden initially
         * */
        if(!IsPostBack)
        {
            Cal1.Visible = false;
        }



       /*********************************/

    }
   /*
     * Calender
     * */
    protected void Cal1_SelectionChanged(object sender, EventArgs e)
    {
       // TextBox1.Text = Convert.ToString(Cal1.SelectedDate);//For full length date and time
        TextBox1.Text = Cal1.SelectedDate.ToShortDateString();//Shorter version of date selection
    }




    /*
     * Show calender push button
     */
    protected void Button1_Click1(object sender, EventArgs e)
    {
        if (Cal1.Visible == false)
        {
            Cal1.Visible = true;
        }
        else
        {
            Cal1.Visible = false;
        }
    }

0 个答案:

没有答案