Reputation: 421
I have:
@:<img src="@Url.Content("~/content/images/lesson_icon/")@mi.LessonId .png" />
But it renders as ...lesson_icon/d40d2ff2-d06b-4fd8-80a0-0ed31bbc04eb%20.png
How can I get rid of the %20
in front of .png
?
Upvotes: 4
Views: 3175
Reputation: 12034
You can send a string with the complete link, for example:
string path = "../content/images/lesson_icon/"
string link = path + mi.LessonId + ".png";
And send that in the model, or you can try:
@{string png = ".png"}
@:<img src="@Url.Content("~/content/images/lesson_icon/")@mi.LessonId + @png />
Upvotes: 0
Reputation: 1039130
You have a space before your file extension that you should remove there:
<img src="@Url.Content(string.Format("~/content/images/lesson_icon/{0}.png", mi.LessonId))" />
or if you are using Razor v2 you could try that:
<img src="~/content/images/lesson_icon/@(mi.LessonId).png" />
Upvotes: 10