Tuesday, 15 May 2012

c# - The foreach block is missing a closing "}" character - when trying to wrap items in rows -



c# - The foreach block is missing a closing "}" character - when trying to wrap items in rows -

the images beingness displayed here different sizes - each set of 3 items should wrapped in <div class="row"></div> in order maintain things getting messy. maintain getting error:

server error in '/' application. parser error description: error occurred during parsing of resource required service request. please review next specific parse error details , modify source file appropriately. parser error message: foreach block missing closing "}" character. create sure have matching "}" character "{" characters within block, , none of "}" characters beingness interpreted markup.

how can format doesn't freak out razor?

<div class="row"> @foreach (var row in model.select((item, index) => new { index, item })) { if (row.index != 0 && row.index % 3 == 0) { </div><div class="row"> } <div class="col-sm-4 mix @string.format(@"category-{0}", row.item.category.tostring())" data-price="64900" data-date="20130521" data-popularity="3"> <div class="ec-box"> <div class="ec-box-header"><a href="#">@row.item.name</a></div> <a href="#"><img src="@row.item.image.url" alt=""></a> <div class="ec-box-footer"> <a href="@url.action("details")" class="btn btn-ar btn-success btn-sm pull-right"><i class="fa fa-search"></i> more info</a> </div> </div> </div> } </div>

you frustrating heck out of parser this

@string.format(@"category-{0}", row.item.category.tostring())

why not?

@("category-" + row.item.category.tostring())

notice utilize of curly brackets {0} in statement.

c# asp.net asp.net-mvc razor

No comments:

Post a Comment