Created
September 5, 2013 20:08
-
-
Save stofte/6455465 to your computer and use it in GitHub Desktop.
Efter du viste mig det der text tag så ville jeg lige prøve det, og der kan være god grund til Html.Raw umiddelbart. Se hvordan output bliver med hhv <text>, og med @Html.Raw. Raw laver ikke whitespace, <text> laver til gengæld nice html ;- ) Whitespace mellem elementer kan virkelig give hovedpiner i forhold til display, så jeg måtte gå tilbage …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code: | |
@for (var i = 0; i < list.Count; i++, index++) | |
{ | |
... | |
<text><a href="@url" class="@className" title="@titleText">@linkText</a></text> | |
@Html.Raw(string.Format(template, url, className, linkText, titleText)); | |
} | |
<text> output: | |
<div class="related-logs"> | |
<a href="/Log/dafdbcef-fb15-4a02-afad-83f0e3de4726" class="" title="Click to view sequence nr. 0 in the series">1</a> | |
<a href="/Log/b2b2b25b-f8ce-4f78-811e-ce405754bcf8" class="" title="Click to view sequence nr. 1 in the series">2</a> | |
<a href="/Log/feee6d06-d4d1-42d2-8376-cd6bac49729f" class="" title="Click to view sequence nr. 3 in the series">3</a> | |
<a href="/Log/2cbca6b9-c220-4a24-b6e9-c77a8b72dbb6" class="" title="Click to view sequence nr. 5 in the series">4</a> | |
<a href="/Log/9ed5bab0-6b50-4ba8-8190-1a46f049b406" class="" title="Click to view sequence nr. 6 in the series">5</a> | |
<a href="/Log/bd2edfbf-ad19-4105-984b-84b2e64f789b" class="" title="Click to view sequence nr. 11 in the series">6</a> | |
<a href="/Log/a7063ea2-afa5-4adf-99b3-97da180428b8" class="" title="Click to view sequence nr. 12 in the series">7</a> | |
<a href="/Log/c68f6324-bc31-4892-8d8b-f7a8b032846a" class="" title="Click to view sequence nr. 14 in the series">8</a> | |
<a href="/Log/26c38915-2509-4a5b-bc75-6da2cd18cfb9" class="active" title="Click to view sequence nr. 15 in the series">9</a> | |
<a href="/Log/46bc0f5a-bc34-4c73-9829-5e93c57843aa" class="" title="Click to view sequence nr. 17 in the series">10</a> | |
</div> | |
@Html.Raw output: | |
<div class="related-logs"> | |
<a href="/Log/dafdbcef-fb15-4a02-afad-83f0e3de4726" class="" title="Click to view sequence nr. 0 in the series">1</a><a href="/Log/b2b2b25b-f8ce-4f78-811e-ce405754bcf8" class="" title="Click to view sequence nr. 1 in the series">2</a><a href="/Log/feee6d06-d4d1-42d2-8376-cd6bac49729f" class="" title="Click to view sequence nr. 3 in the series">3</a><a href="/Log/2cbca6b9-c220-4a24-b6e9-c77a8b72dbb6" class="" title="Click to view sequence nr. 5 in the series">4</a><a href="/Log/9ed5bab0-6b50-4ba8-8190-1a46f049b406" class="" title="Click to view sequence nr. 6 in the series">5</a><a href="/Log/bd2edfbf-ad19-4105-984b-84b2e64f789b" class="" title="Click to view sequence nr. 11 in the series">6</a><a href="/Log/a7063ea2-afa5-4adf-99b3-97da180428b8" class="" title="Click to view sequence nr. 12 in the series">7</a><a href="/Log/c68f6324-bc31-4892-8d8b-f7a8b032846a" class="" title="Click to view sequence nr. 14 in the series">8</a><a href="/Log/26c38915-2509-4a5b-bc75-6da2cd18cfb9" class="active" title="Click to view sequence nr. 15 in the series">9</a><a href="/Log/46bc0f5a-bc34-4c73-9829-5e93c57843aa" class="" title="Click to view sequence nr. 17 in the series">10</a> </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment