public class Player { public String ImagePath { get { return "~/Content/img/sql_error.JPG"; } }
@model SoulMasters.Models.Game.Player @{ ViewBag.Title = "Game"; Layout = "~/Views/Shared/_GameLayout.cshtml"; var imagePath = @Model.ImagePath; } <fieldset> <legend>Player</legend> <div class="display-field"> @Html.DisplayFor(model => model.ImagePath) </div> @imagePath <div style="padding:10px;"> <img src=@imagePath alt="Sample Image" width="300px" /> <img alt="asd" > model.ImagePath; </img> </div> </fieldset>
~/Content/img/sql_error.JPG ~/Content/img/sql_error.JPG Sample Image asd model.ImagePath;
<img src="~/Content/img/sql_error.JPG" alt="Sample Image" width="300px" />
<img src="@Url.Content(Model.ImagePath)" alt="Image" />
<pre><pre lang="Javascript">
<img src= "@Url.Content(Model.ImagePath)" alt="Sample Image" style="height:50px;width:100px;"/><br /> <br /> (or)<br /> <br /> <img src="~/Content/img/@Url.Content(model =>model.ImagePath)" style="height:50px;width:100px;"/>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)