在 ASP.Net (4.5.2) 中,我有嵌套<span>
元素,其中父元素是一组作为服务器端控件...
<p>
This is the start of the text
<span runat="server" visible="<%#someCode%>">
This is some more Text
<span class="myClass">with some other text inside</span>
And a bit more after
</span>
</p>
(注意,这包含在 a 中<asp:Repeater>
)
似乎 ASP.Net 无法解决这个问题,并且似乎假设内部</span>
是外部元素的闭包。这意味着当visible="false"
它会呈现这样的......
<p>
This is the start of the text
And a bit more after
</span>
</p>
我不能转换<span>
为 a<div>
或<section>
因为它必须存在于一个<p>
元素中(这意味着子元素不能是块)。
有没有办法解决这个问题?