现在的位置: 首页 > 综合 > 正文

日历换件在页面中的设置注意点

2013年10月04日 ⁄ 综合 ⁄ 共 557字 ⁄ 字号 评论关闭

        // protected void btnOK_Click(object sender, EventArgs e)
    {
        //设置日历控件在页面中的位置(截取按钮所在位置,设置日历所在位置)
        Calendar1.Style["TOP"] = (Convert.ToInt32(btnOK.Style["top"].Substring(0, btnOK.Style["top"].IndexOf("p"))) + 24) + "px";     
        Calendar1.Visible = !Calendar1.Visible;//当隐藏时显示,显示时隐藏
    }

 

 

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        //从日历中截取如"2010-4-14"这样的日期格式
        txtDate.Text = Calendar1.SelectedDate.ToString().Substring(0, Calendar1.SelectedDate.ToString().IndexOf(" ")).ToString();
        Calendar1.Visible = false;
    }

抱歉!评论已关闭.