c# - A .cshtml mix goes wrong -
i try implement loop displaying small boxes.. following first code has result :

(code) :
<div class="row"> <div class="col-lg-3 col-xs-6"> <!-- small box --> <!-- achtung hier soll man vielleicht die adresse ändern --> @{for (int = 0; < model.liststations.length; i++) { string urltemp = model.liststations[i]; string colortemp = "small-box bg-" + model.listcolors[i % model.listcolors.length]; system.diagnostics.debug.writeline(colortemp); <div class= "small-box bg-blue"> <div class="inner"> <h3>station</h3> <p> model.liststations[i]</p> </div> <div class="icon"> <i class="fa fa-heartbeat" aria-hidden="true"></i> </div> <a href= @urltemp class="small-box-footer">more info <i class="fa fa-arrow-circle-right"></i></a> </div>; } } </div> </div><!-- /.row --> but when change "small-box bg-blue" @colortemp, list containing "small-box bg-blue", "small-box bg-black" , "small-box bg-green", :

i suppose there subtle html specificity missed (or not), has idea what's going wrong ? edit : generated html code :
<div class="row"> <div class="col-lg-3 col-xs-6"> <!-- small box --> <!-- achtung hier soll man vielleicht die adresse ändern --> <div class= 'small-box bg-blue'> <div class="inner"> <h3>station</h3> <p> model.liststations[i]</p> </div> <div class="icon"> <i class="fa fa-heartbeat" aria-hidden="true"></i> </div> <a href= station1 class="small-box-footer">more info <i class="fa fa-arrow-circle-right"></i></a> </div> <div class= 'small-box bg-black'> <div class="inner"> <h3>station</h3> <p> model.liststations[i]</p> </div> <div class="icon"> <i class="fa fa-heartbeat" aria-hidden="true"></i> </div> <a href= station2 class="small-box-footer">more info <i class="fa fa-arrow-circle-right"></i></a> </div> <div class= 'small-box bg-green'> <div class="inner"> <h3>station</h3> <p> model.liststations[i]</p> </div> <div class="icon"> <i class="fa fa-heartbeat" aria-hidden="true"></i> </div> <a href= station3 class="small-box-footer">more info <i class="fa fa-arrow-circle-right"></i></a> </div> </div> </div>
to share others can encounter kind of problem, here solution.
in generated html, there ' instead of double-quotes.
to avoid this, have replace <div class= "small-box bg-blue"> <div class="@(colortemp)">
Comments
Post a Comment