So I just have a beef with the way Visual Studio formats razor code. I\'ve always had some problems with visual studio and how it formats UI code, it always seems to do a re
For all the people whingeing about Visual Studio, I think it's pretty impressive that it allows you to switch between HTML and C# without being told which language you're using.
On a more practical note, I think my advice would be to combine lots of the things shown above. Specifically ...
Given these two I've found that CTRL K, D to reformat code gave perfect results for a table block which has been driving me mad:
Chapter
@*Page count *@
Contents
@{
foreach (var c in Model.Chapters)
{
if (c.Courseware2Id == c2.Courseware2Id)
{
@{
if (c.ChapterFileName.ToString().ToLower() == "none")
{
WriteLiteral(c.Courseware3Name);
}
else
{
@c.Courseware3Name (click to download)
}
}
(@c.PageCount page@(c.PageCount == 1 ? "" : "s"))
@Html.Raw(c.SectionText)
}
}
}
Perfect! Thanks to all StackOverflow contributors above.
- 热议问题