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

解决方案 »

  1.   

    给一个ImageButton,图片显示的有下列的样子(可以参考ctrip),当点击这个按钮时calendar可见,选择日期后calendar隐藏
      

  2.   

    谢谢先,但如何点击下拉框时让calendar显示,选中日期后又隐藏呢?
      

  3.   

    让calendar显示在.dorpdownlist的selectchange事件里改变calendar.visable=true
    选种的话应该就是calendar.selectchange事件改变calendar.visable=false
      

  4.   

    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;
    }
      

  5.   

    你可以参考: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
      

  6.   

    大哥,做得好难啊。
    加了个panel,但点击就不出来,还有点击后它还刷新页面,这样可不好。因为还有其他填写,一刷新就没了。。private void ImageButtonCalender_Click(object sender,System.Web.UI.ImageClickEventArgs e)
    {
    if (ViewState["calendar"]==null)
    {
    ViewState["calendar"]="true";
    if(ViewState["calendar"].ToString()=="true")
    {
    ViewState["calendar"]="false";
    }
    else
    {
    ViewState["calendar"]="true";
    }
    }
    this.PanelPgetdt.Visible=Convert.ToBoolean(ViewState["calendar"]);ViewState是这样用的吧?