So I totally buy into the basic tenents of ASP.NET, testability, SoC, HTML control...it\'s awesome. However being new to it I have a huge hang up with the markup. I know it co
There are things you can do to help clean up the markup, but I agree it can get a bit tag-soupy.
ViewData.Model.myProperty
rather than (MyClasst)ViewData["foo"].myProperty
For instance this is an extension I made to make an RSS-spitter-outer :)
public static string RSSRepeater(this HtmlHelper html, IEnumerable rss) where T : IRSSable
{
StringBuilder result = new StringBuilder();
if (rss.Count() > 0)
{
foreach (IRSSable item in rss)
{
result.Append("- ").Append(item.GetRSSItem().InnerXml).Append("
");
}
}
return result.ToString();
}
So in my front end all I have is <%=Html.RSSRepeater(mydata)%>
which is much nicer.