vendredi 30 mars 2018

Asp.net MVC if statement working in a view but not a modal (same logic)

I am using logic to display certain text one on view that is working, and using that same logic in a modal which is only showing the else part of the statement, not the if.

This is the one that works as it should:

@if (Model.JobId > 0)
{ <a href='@Url.Action("Index", "Summary", new { id = Model.ScenarioId }, null)'>@Model.JobName&nbsp;&nbsp;Summary</a> }
else
{ <a href='@Url.Action("Index", "Summary", new { id = Model.ScenarioId }, null)'>@Model.Name&nbsp;&nbsp;Summary</a> }

and here is the one that only shows the else part of the statement, the if just returns blank.

@if (Model.JobId > 0)
{ <h4 class="modal-title" id="myModalLabel">@Model.Customer.FirstName @Model.Customer.LastName &nbsp;&nbsp;|&nbsp;&nbsp; @Model.JobName</h4> }
else
{ <h4 class="modal-title" id="myModalLabel">@Model.Customer.FirstName @Model.Customer.LastName &nbsp;&nbsp;|&nbsp;&nbsp; @Model.Name</h4> }

Aucun commentaire:

Enregistrer un commentaire