I inherited an ASP.Net WebPages with Razor project that I need to enhance. On post, I need to check to see if the user has filled out a questionnaire, and if not, pop up a dialog telling them to complete it before redirecting them to the questionnaire page. The condition check works, as does the Reponse.Redirect. The pop up code that I got from here does not. Any ideas. Here's the code:
In the head of the doc, I have this:
<link href="~/Content/jquery-ui-1.12.1.css" rel="stylesheet" type="text/css" >
<script src="~/Scripts/jquery-1.12.4.js"></script>
<script src="~/Scripts/jquery-ui-1.12.1.js"></script>
and in the body:
if (IsPost && !questionnaireCompleted) // this works
{
<div id="dialog" title="Incomplete Questionnaire">
<p>You must complete the questionnaire before you can save!</p>
</div>
<script type="text/javascript">
$(function () {
$("#dialog").dialog();
});
</script>
Response.Redirect("~/Sections/Questionnaire?id=" + id); // this works
}