html - Why am I getting """j"" is not valid at the start of a code block." here? -


i've got in index.cshtml (view) code:

<div class="col-md-6">     <label class="control-label">delivery performance (report spans number of days)</label>     <br>     <label>from</label>     <select>         @for (int = 1; <= @maxdaysbackfordeliveryperformance; i++)         {             <option id="selitem_@(i) value=@"i">@i</option>         }     </select>     <label>days back</label>     <br>     <label>to</label>     <select>         @for (int j = 1; j <= @maxdaysbackfordeliveryperformance; j++)         {             <option id="selitem_@(j) value=@"j">@j</option>         }     </select>     <label>days back</label>     <br>     <button id="btntestdeliveryperformancesettings">test settings</button> </div> 

this ran fine (prior adding part @ bottom):

<div class="col-md-6">     <label class="control-label">delivery performance (report spans number of days)</label>     <br>     <label>from</label>     <select>         @for (int = 1; <= @maxdaysbackfordeliveryperformance; i++)         {             <option id="selitem_@(i) value=@"i">@i</option>         }     </select>     <label>days back</label> </div> 

...but when added identical code:

<br> <label>to</label> <select>     @for (int j = 1; j <= @maxdaysbackfordeliveryperformance; j++)     {         <option id="selitem_@(j) value=@"j">@j</option>     } </select> <label>days back</label> <br> <button id="btntestdeliveryperformancesettings">test settings</button> 

...it fails parser error. don't see "j" @ start of code block sees?

this line (193) implicates:

<option id="selitem_@(j) value=@"j">@j</option> 

what has gone haywire/south?

update

shifting @ sign inside quotes so:

<option id="selitem_@(j) value="@j">@j</option> 

...moved err msg 2 lines; it's complaining line:

@for (int j = 1; j <= @maxdaysbackfordeliveryperformance; j++) 

...saying that, "the block missing closing "}" character. make sure have matching "}" character "{" characters within block, , none of "}" characters being interpreted markup."

you not wrapping id , value attribute values in quotes.

wrap variable in "" or ''.

@for (int = 1; <= maxdaysbackfordeliveryperformance; i++) {      <option id="selitem_@(i)" value="@i">@i</option> } 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -