开发者

how i can write razor if else in razor section?

i want to write this code in section i define in

 i开发者_C百科f(ViewBag.Resetpass){
    <meta http-equiv="refresh" content="3;url=/">
}

in

@section mysection{

}


@section mysection {
    @if((bool)ViewBag.Resetpass)
    {
        <meta http-equiv="refresh" content="3; url=/" />
    }
}

which if you use strongly typed view models (which IMHO you should) could look like this:

@section mysection {
    @if(Model.Resetpass)
    {
        <meta http-equiv="refresh" content="3; url=/" />
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜