如果有一个打开的 `<table>` 标签,Razor `if` 不会注册关闭 `}`? [英] Razor `if` does not register closing `}` if there is an opened `<table>` tag?
问题描述
此代码,在 Razor 视图中:
This code, in a Razor view:
if (true)
{
<table>
<tbody>
}
...
if (true)
{
</tbody>
</table>
}
不运行.它声称在第一个 does not run. It claims that there is no closing 有没有办法解决这个问题来有条件地插入我的 Is there a way I can work around this to conditionally insert my 尝试在标签前加上 这篇关于如果有一个打开的 `<table>` 标签,Razor `if` 不会注册关闭 `}`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!if()
语句上没有结束 }
,我猜这是因为 标签.
}
on the first if()
statement, and I'm guessing it's because of the <table>
tag. 标签?
<table>
tags?推荐答案
@:
:if (true)
{
@:<table>
@:<tbody>
}
...
if (true)
{
@:</tbody>
@:</table>
}
登录
关闭