2

I have a date picker one for begin date and end date, i wanted to check to make sure that the user selects dates so that the begin date is before the end date.

thanks...

Masriyah
  • 2,445
  • 11
  • 49
  • 91

1 Answers1

1

Thanks for everyone's help - this is what i was able to conclude. This is what i added to my post in my controller.cs:

        if (viewModel.BeginDate == null)
            viewModel.BeginDate = DateTime.Today.AddMonths(-6);

        if (viewModel.EndDate == null)
            viewModel.EndDate = DateTime.Today;

        if (viewModel.EndDate < viewModel.BeginDate)
            ModelState.AddModelError("", "Invalid Date Range");

        if (string.IsNullOrEmpty(viewModel.Value))
            ModelState.AddModelError("", "No View Selected");
Masriyah
  • 2,445
  • 11
  • 49
  • 91