mardi 13 mai 2014

asp.net razor if syntax


Vote count:

0




I'm a beginner with ASP.NET MVC and I'm trying to set the src of an image with razor in a asp.net MVC website using an If statement.


this code works :



<img src="@Url.Action("GetPersonPhoto", "Home", new RouteValueDictionary( new { cardid = "696969" }) )" />


I want to add :



@if(Model.HavePhoto)


And set the src to :



"~/Content/images/header-logo.png"


if HavePhoto is false...


How can I do it ?



asked 39 secs ago

Gab

28





Aucun commentaire:

Enregistrer un commentaire