请问怎样实现点一个按钮弹出Calendar,点击某一天后返回选定的日期? 求代码,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void Page_Load(object sender, System.EventArgs e) { if(!this.IsPostBack) this.Calendar1.Visible=false; // 在此处放置用户代码以初始化页面 } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.Button1.Click += new System.EventHandler(this.Button1_Click); this.Calendar1.SelectionChanged += new System.EventHandler(this.Calendar1_SelectionChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void Button1_Click(object sender, System.EventArgs e) { if(this.Calendar1.Visible) this.Calendar1.Visible=false; else this.Calendar1.Visible=true; } private void Calendar1_SelectionChanged(object sender, System.EventArgs e) { this.TextBox1.Text=this.Calendar1.SelectedDate.ToShortDateString(); this.Calendar1.Visible=false; } 最好还是用js控件或者也得采用ajax,这样减少刷新如果你使用js的话,建议你使用梅花雨的控件具体可以看http://www.cnblogs.com/xujh/archive/2005/01/20/94543.html 试一下htc的日历组件吧,很好用.http://potato.blog.hexun.com/1837577_d.htmlhttp://www.mltang.com/article/0c159ac2-6f91-4601-96c5-2274b5c0e3ee.html或搜 htc 日历. VS2008工具箱变灰不可用 Gridview日期时间如何按24小时显示? 关于session保存值的安全性和一个看不懂的脚本问题,请大家帮忙解决. 用户控件报“因此不是有效的基类”这个错误,怎么解决? --------- 从客户端获取服务器端变量的问题?------- 哪位大侠帮忙写类似hao123主页面的动态管理页面 高手进来看看。C#调用组件的问题,在急等。 图片显示问题,请指教! winform ListView Group展开和收缩 datagrid问题 简单的数据库连接问题.. 请大侠们帮我分析下原因,关于用ado.net连接Analysis的问题
{
if(!this.IsPostBack)
this.Calendar1.Visible=false;
// 在此处放置用户代码以初始化页面
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Calendar1.SelectionChanged += new System.EventHandler(this.Calendar1_SelectionChanged);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
if(this.Calendar1.Visible)
this.Calendar1.Visible=false;
else
this.Calendar1.Visible=true;
} private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
this.TextBox1.Text=this.Calendar1.SelectedDate.ToShortDateString();
this.Calendar1.Visible=false;
}
如果你使用js的话,建议你使用梅花雨的控件
具体可以看
http://www.cnblogs.com/xujh/archive/2005/01/20/94543.html
http://potato.blog.hexun.com/1837577_d.html
http://www.mltang.com/article/0c159ac2-6f91-4601-96c5-2274b5c0e3ee.html或搜 htc 日历.