0
    @model Seriebeheer.Domain.Serie

    @{
        ViewBag.Title = "Verijwder serie";
        Layout = "~/Views/Shared/_AdminLayout.cshtml";
    }

    @if (Model != null) 
    {
    <h1>Verwijder @Model.Name</h1>

    Weet u zeker dat u deze serie wilt verwijderen? Dit zal ook alle afleveringen van deze serie verwijderen!<br />

    using (Html.BeginForm("Delete", "SerieAdmin", FormMethod.Post, new {enctype = "multipart/form-data"}))
    {
        @Html.AntiForgeryToken()
        @Html.Hidden("id", @Model.ID)
        <input type="submit" value="Verwijder" />
    }

        <br />
} else 
{ <b>Deze serie bestaat niet</b> }

The above code fails on the "weet u zeker..." line (expected ;). What's wrong with this null check?

Thanks

EDIT: The exact error message: Foutbericht van compiler: CS1002: ; wordt verwacht

Translateed: error message from compiler: CS1002: expected ;

2
  • what's the exact error? Commented Feb 10, 2013 at 14:50
  • Please translate the error into English Please provide the code where you define and declare Model Commented Feb 10, 2013 at 14:51

2 Answers 2

2

Razor engine treats everything in curly brackets { } as code if it is not between html tags. For this one to work you have to add <span> before Weet and </span> after verwijderen!
to this to work. (OF course you can use any html tag you like/want :)

Sign up to request clarification or add additional context in comments.

Comments

0

Better change this

  Weet u zeker dat u deze serie wilt verwijderen? Dit zal ook 
   alle afleveringen van deze serie verwijderen!

to

<text>  Weet u zeker dat u deze serie wilt verwijderen? Dit zal ook
       alle afleveringen van deze serie verwijderen!
</text>

wrapping with text node would be a better choice, which will not hurt your CSS or html Also the Razor view engine will not assume that its a server side code as it start with HTML tag. In your case you are writing Html inside razor with out @{}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.