所以这是一个总的noob问题,但我试图在一个aspx文件中使用VB在一行的末尾添加一个类,并且它不顺利。我做错了什么?
<div class="compare-item-wrapper<%If (n1) Mod 4 = 0 Then " last","" %>">
我收到语法错误。谢谢你的帮助。
答案 0 :(得分:1)
您可以使用If
函数创建表达式:
<div class="compare-item-wrapper<%= If(n1 Mod 4 = 0, " last", "") %>">
或使用End If
和If
语句中的文字值:
<div class="compare-item-wrapper<% If n1 Mod 4 = 0 Then %> last<% End If %>">