0
使用剃刀可以很容易地顯示HTML列表的值:插入模型串點擊
<div id="collapse1" style="display:none">
@{
foreach (var i in Model)
{
<text> <strong>::: @i.City, @i.Country :::</strong> </text>
<p style="margin-bottom:0px"></p>
foreach (var h in i.Weather)
{
{
<div id="MyDiv2">
<strong><small>@DateTime.Now.AddDays(count).ToString("dd/MM/yy")</small></strong>
<p style="margin-bottom:0px"></p>
<text><small>Max: @i.MaxTemp.ElementAt(@count)°</small></text>
<p style="margin-bottom:0px"></p>
<text><small>Min: @i.MinTemp.ElementAt(@count)°</small></text>
<span id="MyTest">the min temp: @i.MinTemp.ElementAt(0) </span>
</div>
}
count++;
}
}
}
</div>
是的,小菜一碟。但是請想象一下,我想在單擊一個按鈕後更改MyTest範圍內的文本,以便它改爲:「最高溫度:@ i.MaxTemp.ElementAt(0)」。
我的問題是,我將不得不混合jQuery(用於按鈕)和剃鬚刀(以獲得maxtemp值)。任何幫助/提示高度讚賞!
你的回答並不完全是我想要的,但它讓我以正確的方式思考它。 –
對此感到高興@ LuisGouveia –
也許你可以幫助我解決另一個問題,在閱讀你的答案後進入我的腦海:http://stackoverflow.com/questions/21934684/mvc-the-right-compromise-between-browser-speed - 和尊重的最模型 –