Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string RSSRepeater<T>(this HtmlHelper html, IEnumerable<T> rss) where T : IRSSable
- {
- StringBuilder result = new StringBuilder();
- if (rss.Count() > 0)
- {
- foreach (IRSSable item in rss)
- {
- result.Append("<item>").Append(item.GetRSSItem().InnerXml).Append("</item>");
- }
- }
- return result.ToString();
- }
- <%-- Go through each testimonial --%>
- <% foreach (var testimonial in ViewData.Model.Testimonials) { %>
- <div class="testimonialFrame">
- <div class="testimonialHeader"><%= testimonial.summaryText %></div>
- <%-- Show video if available --%>
- <% if (string.IsNullOrEmpty(testimonial.Video.FullURL) == false) { %>
- <div style="padding-top:12px">
- <% Html.RenderAction("YouTubeControl", "Application", new { youTubeId = testimonial.Video.FullURL }); %>
- </div>
- <% } %>
- <div class="roundedBox" style="margin-top:15px">
- <div id="txtTestimonialText" class="testimonialText paddedBox"><%= testimonial.TestimonialText %></div>
- </div>
- <div class="testimonialFooter"><%= testimonial.name %></div>
- </div>
- <% } %>
- <%-- render section --%>
- <% RenderTextSection(section); %>
- htmlControl.RenderControl(new HtmlTextWriter(Response.Output));
- protected void RenderTextSection(ProductSectionInfo item)
- {
- HtmlGenericControl sectionTextDiv = new HtmlGenericControl("div");
- bool previousHasBulletPoint = false;
- System.Web.UI.HtmlControls.HtmlControl currentContainer = sectionTextDiv;
- foreach (var txt in item.DescriptionItems)
- {
- if (!previousHasBulletPoint && txt.bp)
- {
- // start bulleted section
- currentContainer = new HtmlGenericControl("UL");
- sectionTextDiv.Controls.Add(currentContainer);
- }
- else if (previousHasBulletPoint && !txt.bp)
- {
- // exit bulleted section
- currentContainer = sectionTextDiv;
- }
- if (txt.bp)
- {
- currentContainer.Controls.Add(new HtmlGenericControl("LI")
- {
- InnerHtml = txt.t
- });
- }
- else
- {
- currentContainer.Controls.Add(new HtmlGenericControl()
- {
- InnerHtml = txt.t
- });
- }
- previousHasBulletPoint = txt.bp;
- }
- sectionTextDiv.RenderControl(new HtmlTextWriter(Response.Output));
- }
Add Comment
Please, Sign In to add comment