日期:2014-05-19  浏览次数:20489 次

c#如何实现dropdownlist和calendar控件结合?
小弟请教个问题:
c#能实现下拉选择日历的功能么?第一次做这个功能,能用dorpdownlist和calendar实现么?
能否给个思路?


------解决方案--------------------
让calendar显示在.dorpdownlist的selectchange事件里改变calendar.visable=true
选种的话应该就是calendar.selectchange事件改变calendar.visable=false
------解决方案--------------------
private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
string date = Calendar1.SelectedDate.ToShortDateString();
txtDepStart.Text = date;//给一个文本框赋值
Calendar1.Visible = false;
}

private void ibtn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
ImageButton ibtn = (ImageButton)sender;
//下面调整日历的位置和按钮协调
Calendar1.Style[ "LEFT "] = ibtn.Style[ "LEFT "];
Calendar1.Style[ "TOP "] = (int.Parse(ibtn.Style[ "TOP "].Substring(0, ibtn.Style[ "TOP "].Length - 2)) + 21) + "px ";
Calendar1.Style[ "POSITION "] = "absolute ";
//隐藏日历控件
Calendar1.Visible = true;
}
------解决方案--------------------
你可以参考:

http://www.google.com/search?q=asp.net%20calendar%20absolute&hl=zh-CN&newwindow=1&rls=com.microsoft%3Aen-US&lr=lang_zh-CN%7Clang_zh-TW&nxpt=20.24705912125465915746