protected void WriteClubs(HtmlTextWriter output) { Region currentRegion = null; IList <Club> clubs = ClubRepository.CreateQuery( "from Club c order by c.Address.Region.Name, c.Name" ).List <Club>(); output.RenderBeginTag(HtmlTextWriterTag.Dl); foreach (Club club in clubs) { if (club.Address.Region != currentRegion) { if (currentRegion != null) { // Render the end of the DD and UL tags. output.RenderEndTag(); output.RenderEndTag(); } currentRegion = club.Address.Region; output.RenderBeginTag(HtmlTextWriterTag.Dt); output.AddAttribute(HtmlTextWriterAttribute.Href, ResolveClientUrl("~" + UrlUtility.For(currentRegion))); output.AddAttribute(HtmlTextWriterAttribute.Title, string.Format( "View RC clubs in the {0} area on the map", currentRegion.Name)); output.RenderBeginTag(HtmlTextWriterTag.A); output.WriteEncodedText(currentRegion.Name); output.RenderEndTag(); output.RenderEndTag(); output.RenderBeginTag(HtmlTextWriterTag.Dd); output.RenderBeginTag(HtmlTextWriterTag.Ul); } output.RenderBeginTag(HtmlTextWriterTag.Li); output.AddAttribute(HtmlTextWriterAttribute.Href, ResolveClientUrl("~" + UrlUtility.For(club))); output.AddAttribute(HtmlTextWriterAttribute.Title, string.Format( "Go to {0} on the map", club.Name)); output.RenderBeginTag(HtmlTextWriterTag.A); output.WriteEncodedText(club.Name); output.RenderEndTag(); output.RenderEndTag(); } // Render the end of the DD and UL tags. output.RenderEndTag(); output.RenderEndTag(); // Render the end of the DL list. output.RenderEndTag(); }
private static XmlElement CreateItemElement(Location location, XmlDocument document) { XmlElement item = document.CreateElement("item"); string href = string.Format(ITEM_URL, UrlUtility.For(location)); XmlElement guid = CreateTextElement("guid", href, document); item.AppendChild(CreateTextElement("title", location.Name, document)); item.AppendChild(CreateTextElement("link", href, document)); item.AppendChild(CreateDescriptionElement(location, document)); foreach (XmlElement category in CreateCategoryElements(location, document)) { item.AppendChild(category); } item.AppendChild(CreateTextElement("pubDate", DataUtility.ToString(location.CreatedOn, "r"), document)); guid.SetAttribute("isPermaLink", "true"); item.AppendChild(guid); return(item); }