protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); XmlDocument document = new XmlDocument(); XmlElement root = document.CreateElement("slideshow"); if (DisplayTime > 0) { root.SetAttribute("displayTime", DisplayTime.ToString()); } if (TransitionTime > 0) { root.SetAttribute("transitionTime", TransitionTime.ToString()); } var valid = Slides.Where(slide => !string.IsNullOrEmpty(slide.ImageUrl)); var elements = valid.Select(slide => slide.ToXmlElement(document)).ToList(); elements.ForEach(element => root.AppendChild(element)); document.AppendChild(root); ConfigXml = HttpUtility.UrlEncode(document.OuterXml); FlashAvailable = elements.Count > 0; }
private string GetCalendarSetupScript(string inputField, string format, string trigger) { StringBuilder sb = new StringBuilder(); sb.Append("<script type=\"text/javascript\">Calendar.setup( { inputField : \""); sb.Append(inputField); sb.Append("\", ifFormat : \""); sb.Append(format); sb.Append("\", button : \""); sb.Append(trigger); sb.Append("\", showsTime : "); sb.Append(DisplayTime.ToString().ToLower()); sb.Append(" } ); </script>"); return(sb.ToString()); }