I have a search program that will be looking at a database from a database. If the date range is more than 3 weeks I want to alert them that it might take a while with all the data in the database. I have a confirm message box in a JavaScript function. I want to check the date range in the aspx.cs page. how do I totrigger the message box based on that criteria? here is a copy of some of my code on html. I am not sure how to approach the checkpoint.
function warning() { var answer = confirm('The date range you have selected will return a substantial amount of data and will take some time to process.\n\nAre you sure you want to continue?'); if (answer) return true; else return false; }
If the button is a submit button, then add this to the onclick(). A true return value will allow the page to continue submitting, and a false will stop the postback (submit).
EDIT: Just try it before you say that its not right. It looks complicated but its pretty simple. Get the first date, Get the second date, compare them. If there is less than 3 weeks diff, return true and allow the page to post back (submit), else alert the user and return thier answer.
The function…