문제

I'm using MS Razor in MVC 3 C#, I need to display some text "hello" within the IF statement. At the moment I receive an error. Any idea how to solve it?

EDIT: syntax error

   @if(Model.IsCustomEvent)
    {
        @Html.ActionLink("Edit", "Edit", new {  id=Model.EventTitle }) hello
    }
도움이 되었습니까?

해결책

you need to put : before hello

 @if(Model.IsCustomEvent)
    {
        @Html.ActionLink("Edit", "Edit", new {  id=Model.EventTitle }) @:hello
    }

Here is a good reference

다른 팁

Use the @: symbol for including literals

@if(Model.IsCustomEvent)
{
    @Html.ActionLink("Edit", "Edit", new {  id=Model.EventTitle }) 
    @:hello
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top