日期时间asp.net结束日期超过开始日期

时间:2015-08-05 03:38:40

标签: c# asp.net

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
    tb_startDate.Text = Calendar1.SelectedDate.ToString("d");
    //become false when click
    Calendar1.Visible = false;
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
    //if dont allow weekend, type "if(e.Day.IsOtherMonth || e.Day.IsWeekend)"
   if(e.Day.IsOtherMonth)
   {
       e.Day.IsSelectable = false;
       e.Cell.BackColor = System.Drawing.Color.Gray;
   }
}


protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
    if (Calendar2.Visible)
    {
        Calendar2.Visible = false;
    }
    else
    {
        Calendar2.Visible = true;
    }
    // when click, calender pop

}


protected void Calendar2_SelectionChanged(object sender, EventArgs e)
{
    tb_endDate.Text = Calendar2.SelectedDate.ToString("d");
    //become false when click
    Calendar2.Visible = false;
}
protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
{
    //if dont allow weekend, type "if(e.Day.IsOtherMonth || e.Day.IsWeekend)"
    if (e.Day.IsOtherMonth)
    {
        e.Day.IsSelectable = false;
        e.Cell.BackColor = System.Drawing.Color.Gray;
    }

}
protected void btn_Confirm_Click(object sender, EventArgs e)
{
    int result = 0;
    Response.Write("<script>alert('Submitted Successfullly')</script>");

    storage st = new storage(tb_sId.Text,ddl_brandName.Text,tb_modelName.Text,tb_startDate.Text,tb_endDate.Text,tb_Desc.Text,ddl_Colour.Text);



    result = st.StorageInsert();
    if (result > 0)
    {
        Response.Write("<script>alert('Storage Added Successfullly')</script>");

    }
    else
    {
        Response.Write("<script>alert('Storage Added not successfull')</script>");
    }

如何使结束日期超过开始日期?

假设开始日期为05/08/2015。结束日期必须超过05天,超过08个月,超过2015年。

0 个答案:

没有答案