jquery - What could be causing me to get the YSOD: "Section blocks cannot be nested. Only one level of section blocks are allowed."? -


i can see, indeed, code above section flagged suspicious above wrong, because closing "}" not yellow.

at top of page have using directives:

@using system.configuration @model ccrreporter.models.tlisreportmodel  @{     viewbag.title = "transaction line item sales report criteria";     viewbag.pagename = viewbag.title; } 

...followed script section:

@section scriptcontent {     <script src="@url.content("~/scripts/jquery.validate.min.js")" type="text/javascript" defer> </script>     <script src="@url.content("~/scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript" defer> </script>     // etc.  <script type="text/javascript">         var bsubmitting = false;         var wantsfocus = null;         var bfocusing = false;         var report_parms = null;          function settaborder() {             $.each([                 "#begindate",                 "#begintime",                 "#enddate",                 "#endtime",                 "#inputsite-input",                 "#cmdaddsite",                 "#inputdept-input",                 "#cmdadddept",                 "#includedepts",                 "#excludedepts",                 "#upcbeginswith"],             function (i, n) {                 $(n).prop("taborder", "y");             });         }          // ready handler         $(function() {     // etc. 

...this jquery has been validated via jsfiddle/jshint.

here ysod:

parser error description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately.  parser error message: section blocks ("@section header { ... }") cannot nested.  1 level of section blocks allowed.  source error:  line 402:} line 403: line 404:@section mainhead line 405:{ line 406:    <link href="@url.content("http://code.jquery.com/ui/1.9.2/themes/smoothness/jquery-ui.css")" rel="stylesheet" type="text/css" />  source file: /ccrreporter/views/ccrcriteria/tlisreport.cshtml    line: 404 

i've looked on code multiple times, , have no idea problem is. has run before, or know of trick finding problem lies?

i still couldn't find syntactical problem code, on closer inspection, logic of code seemed quite bizabre (combination of bizarre , macabre):

it had submit_button click handler called $("form").submit();

if "submit_button" submit button (input type="submit") - , is!, why necessary? not that, function called click handler had been declared way:

$("#form0").submit(function() { 

form0? hec ramsey?!? there no "form0" anywhere on page...

once moved code submitting form0 handler (which, admit, had changed selecting phantom 'form0' 'form') submit_button handler, much-awaited , yearningly longed yellow background returned section's ending "}".

voila!

maybe debugger smarter thought: goes on strike not when code doesn't compile, @ times, apparently, when (the code, or, extension, carbon-based biped wrote it) candidate loony bin.

alas -- know why caged bird sings: trapped maintaining code of birdbrains had flown coop!


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -