I’ve searched a fair bit round and tried a number of potential solutions, suggested on their respective threads on various sites, to which none have worked for me.
My objective is to make sure the date entered, and to be stored, is not ‘less than’ (before) the present date
i.e. Booking a reservation for a restaurant.
The first is:
“The ControlToValidate property of ‘cvDate’ cannot be blank…”
I’ve tried specifying it in page_load and .aspx source, the same has happened in both, in addition to ValueToCompare. I cant understand why it cant detect it?
public partial class GenResEnquiry : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
IFormatProvider culture = new CultureInfo("en-GB", true);
cvDate.ValueToCompare = DateTime.Today.ToShortDateString();
cvDate.ControlToCompare = txtDate.Text.ToString();
NB: Page.Databind(); was one of those suggestions in another thread which hasnt yet hindered or helped it. others included, in the .aspx page source, changing ValueToCompare=<%= … to #
That hasn’t worked either Im still getting the error:
"The ControlToValidate property of ‘cvDate’ cannot be blank.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The ControlToValidate property of ‘cvDate’ cannot be blank."
I’ve even tested it in a blank page just incase there is any conflictions elsewhere - same error. Is it worth posting the whole pages contents?