samedi 23 avril 2016

Razor Page using @if how to?

So I have an Index.cshtml page where I have the following code snippet:

<dt>Description</dt>
        <dd>

            @(Model.Description ?? "None")
            [
            @if (Model.Description != null)
            {
                @Html.ActionLink("Change", "ChangeDescription")
            }

            ]

        </dd>

Right now, when the Model.Description is NULL, the text will change to "Description: None". How can I make it so if it is NULL not even the doesn't show? Basically the line should be empty unless the model.description is not null. I am not sure about the correct syntax.

Aucun commentaire:

Enregistrer un commentaire