我有一个日历范围的javascript日历日期选择器,用于从数据库中重新生成数据。我需要在上一个/下个月或年份点击时停止刷新它。
<label>From</label>
<asp:TextBox ID="StartDate" AutoPostBack="True"
MaxLength="10" width="90px" Height='18px' runat="server"
OnTextChanged ="StartDate_OnSelectedIndexChanged" />
<img src="/Images/calendar.gif" class='calendarImage' id="ShowStartDate" />
<script type="text/javascript">
Calendar.setup({
inputField: "<%=StartDate.ClientID %>", // ID of the input field
ifFormat: "%m/%d/%Y", // the date format
button: "ShowStartDate" // ID of the button
});
</script>
<label>To</label>
<asp:TextBox ID="EndDate" MaxLength="10" Width="90px" Height='18px'
runat="server" AutoPostBack="True"
OnTextChanged ="EndDate_OnSelectedIndexChanged" />
<img src="/Images/calendar.gif" class='calendarImage' id="ShowEndDate" />
<script type="text/javascript">
Calendar.setup({
inputField: "<%=EndDate.ClientID %>", // ID of the input field
ifFormat: "%m/%d/%Y", // the date format
button: "ShowEndDate" // ID of the button
});
</script>
这是事件处理程序:
protected void StartDate_OnSelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
protected void EndDate_OnSelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}