日历Extendar没有显示启动一个TextBox的日期到另一个文本框选定的日期 [英] Calendar Extendar is not showing Starting Date of one textbox to selected date of another textbox

查看:141
本文介绍了日历Extendar没有显示启动一个TextBox的日期到另一个文本框选定的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会尝试尽可能简化我的查询。我使用的文本框,一个是开始日期,一个是为结束日期。开始日期运作良好,但在截至日期是开始日期应选择开始日期文本框的日期。

I'll try to simplify my query as much as possible. I am using to textboxes one is for starting date and one is for ending date. starting date is working well but in ending date it's start date should be selected date of starting date textbox.

下面是我的code。

protected void txtSRPStartDate_TextChanged(object sender, EventArgs e)
{
    txtSRPEndingDate_CalendarExtender.StartDate = Convert.ToDateTime(txtSRPStartDate_CalendarExtender.SelectedDate);
    txtSRPEndingDate_CalendarExtender.EndDate = DateTime.Now;
}

在当我调试的code此code它显示了我选择的开始日期文本框的日期

In this code when i'd debugged the code it's showing me selected date of starting date textbox as null.

任何建议,请。

推荐答案

报价在谷歌搜索的第一个环节。

Quote from the first link in a google search.

在CalendarExtender的将selectedDate只是设置一个初始
  在日历上所选日期。

The SelectedDate of the CalendarExtender is just to set an initial selected date on the calendar.

您不能使用是让用户最后选定的日期。该
  selectedDate属性不更新为用户选择!!日期

You can't use is to get the last selected date by the user. The selectedDate property isn't updated to the date the user selects!!

因此​​,不是,你需要得到从文本框的日期不是日历扩展。

So instead, you need to get the date from the textbox not the calendar extender.

protected void txtSRPStartDate_TextChanged(object sender, EventArgs e)
{
    txtSRPEndingDate_CalendarExtender.StartDate = Convert.ToDateTime(txtSRPStartDate.Text);
    txtSRPEndingDate_CalendarExtender.EndDate = DateTime.Now;
}

这篇关于日历Extendar没有显示启动一个TextBox的日期到另一个文本框选定的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆