CNSA-216-Personal/CH46/main.aspx.cs
2024-03-18 10:09:13 -04:00

44 lines
1.4 KiB
C#

using System;
using System.Web.UI;
namespace CH46
{
public partial class main : Page
{
protected void Page_Load(object sender, EventArgs e)
{
DateTime dptMin, dptMax;
rgvDepart.MinimumValue = DateTime.Now.ToShortDateString();
rgvDepart.MaximumValue = DateTime.Now.AddDays(30).ToShortDateString();
txtDepart.Text = DateTime.Now.ToShortDateString();
dptMin = DateTime.Parse(txtDepart.Text);
dptMax = Convert.ToDateTime(txtDepart.Text.ToString());
RangeValidator1.MinimumValue = dptMin.AddDays(14).ToShortDateString();
RangeValidator1.MaximumValue = dptMax.AddDays(14).ToShortDateString();
txtArrival.Text = RangeValidator1.MaximumValue.ToString();
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
if (rdoTest.SelectedValue == "Arrival")
{
txtArrival.Text = Calendar1.SelectedDate.ToShortDateString();
}
else if (rdoTest.SelectedValue == "Departure")
{
txtDepart.Text = Calendar1.SelectedDate.ToShortDateString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
Label1.Text = "You are set to arrive on: " + txtArrival.Text;
}
}
}
}