剃刀不明白未闭合的HTML标签 [英] Razor doesn't understand unclosed html tags
本文介绍了剃刀不明白未闭合的HTML标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过RazorViewEngine,我可以这样做:
With RazorViewEngine, I can do this:
if (somecondition) {
<div> some stuff </div>
}
但我似乎无法做到这一点(剃刀迷糊):
but I can't seem to do this (Razor gets confused):
if (somecondition) {
<div>
}
if (someothercondition) {
</div>
}
我有,我需要把我的开幕式和闭幕式的HTML标记在不同的code块的情况 - 我如何在剃刀做到这一点。
I have a situation in which I need to put my opening and closing html tags in different code blocks - how can I do this in Razor?
推荐答案
尝试这样的:
if (somecondition) {
@:<div>
}
这篇关于剃刀不明白未闭合的HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文