Cha*_*ell 2 vb.net if-statement razor asp.net-mvc-3
在Fredrik的博客文章中,他有一个C#if语句的例子
@if (WebSecurity.IsAuthenticated) {
<li><a href="/user/login">Log in</a></li>
} else {
<li><a href="/user/logout">Log out</a></li>
}
Run Code Online (Sandbox Code Playgroud)
但在VB中我似乎无法弄清楚如何做同样的事情
@If (HttpContext.Current.User.Identity.IsAuthenticated) Then
<div id="dialog-confirm" title="Log Out">
<div class="alert" title="Alert">
</div>
Are you sure?</div>
End If
Run Code Online (Sandbox Code Playgroud)
这个节目表明我的内部HTML标记是错误的.
基本上以下是有效的
@If (HttpContext.Current.User.Identity.IsAuthenticated) Then
End If
Run Code Online (Sandbox Code Playgroud)
但if语句中的任何内容都被视为"代码"而不是"标记".我需要的是能够将标记放在那里.
有谁知道如何在Razor VB中做一个正确的if语句?
Cha*_*ell 10
@Lucas指出我正确的方向.这似乎是有效的
@If (HttpContext.Current.User.Identity.IsAuthenticated) Then
@<div id="dialog-confirm" title="Log Out">
<div class="alert" title="Alert"></div>
<div>Are you sure?</div>
</div>
End If
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5880 次 |
| 最近记录: |