protected override void Render(HtmlTextWriter output) { //Render the main div output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID); output.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass + " panelContainer"); output.RenderBeginTag(HtmlTextWriterTag.Div); output.AddAttribute(HtmlTextWriterAttribute.Class, "panelHeaderText"); output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "-header-text"); output.RenderBeginTag(HtmlTextWriterTag.H3); output.Write(Title); output.RenderEndTag(); //Render div for contents output.AddAttribute(HtmlTextWriterAttribute.Class, "panelBody"); output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "-body"); output.RenderBeginTag(HtmlTextWriterTag.Div); foreach (Control c in this.Controls) { c.RenderControl(output); } output.RenderEndTag(); output.RenderEndTag(); //Hidden var for keeping status if (AllowCollapsing) { output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden"); output.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID + "-collapsedStatus"); output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "-collapsedStatus"); output.AddAttribute(HtmlTextWriterAttribute.Value, IsCollapsed.ToString()); output.RenderBeginTag(HtmlTextWriterTag.Input); output.RenderEndTag(); //Script to init the box. output.AddAttribute("type", "text/javascript"); output.RenderBeginTag(HtmlTextWriterTag.Script); output.Write(GetJSObjCreationString()); output.RenderEndTag(); } }
/// <summary> /// Generates Xml representation of this gadget /// </summary> /// <param name="doc">The Xml docment</param> /// <returns>XmlNode</returns> public override XmlNode Serialize(XmlDocument doc) { CombinedFrequencyParameters combFreqParameters = (CombinedFrequencyParameters)Parameters; System.Xml.XmlElement element = doc.CreateElement("combinedFrequencyGadget"); //element.InnerXml = xmlString; element.AppendChild(SerializeFilters(doc)); System.Xml.XmlAttribute id = doc.CreateAttribute("id"); System.Xml.XmlAttribute locationY = doc.CreateAttribute("top"); System.Xml.XmlAttribute locationX = doc.CreateAttribute("left"); System.Xml.XmlAttribute collapsed = doc.CreateAttribute("collapsed"); System.Xml.XmlAttribute type = doc.CreateAttribute("gadgetType"); System.Xml.XmlAttribute actualHeight = doc.CreateAttribute("actualHeight"); id.Value = this.UniqueIdentifier.ToString(); locationY.Value = Canvas.GetTop(this).ToString("F0"); locationX.Value = Canvas.GetLeft(this).ToString("F0"); collapsed.Value = IsCollapsed.ToString(); type.Value = "EpiDashboard.CombinedFrequencyControl"; actualHeight.Value = this.ActualHeight.ToString(); element.Attributes.Append(locationY); element.Attributes.Append(locationX); element.Attributes.Append(collapsed); element.Attributes.Append(type); element.Attributes.Append(id); if (IsCollapsed == false) { element.Attributes.Append(actualHeight); } XmlElement combineModeElement = doc.CreateElement("combineMode"); combineModeElement.InnerText = combFreqParameters.CombineMode.ToString(); element.AppendChild(combineModeElement); XmlElement trueValueElement = doc.CreateElement("trueValue"); trueValueElement.InnerText = combFreqParameters.TrueValue.ToString(); element.AppendChild(trueValueElement); XmlElement sortElement = doc.CreateElement("sort"); if (combFreqParameters.SortHighToLow) { sortElement.InnerText = "hightolow"; } element.AppendChild(sortElement); XmlElement showDenominatorElement = doc.CreateElement("showDenominator"); showDenominatorElement.InnerText = combFreqParameters.ShowDenominator.ToString(); element.AppendChild(showDenominatorElement); XmlElement customHeadingElement = doc.CreateElement("customHeading"); customHeadingElement.InnerText = combFreqParameters.GadgetTitle.Replace("<", "<"); element.AppendChild(customHeadingElement); XmlElement customDescElement = doc.CreateElement("customDescription"); customDescElement.InnerText = combFreqParameters.GadgetDescription.Replace("<", "<"); element.AppendChild(customDescElement); SerializeAnchors(element); XmlElement groupItemElement = doc.CreateElement("groupFields"); string xmlGroupItemString = string.Empty; foreach (string columnName in combFreqParameters.ColumnNames) { xmlGroupItemString = xmlGroupItemString + "<groupField>" + columnName.Replace("<", "<") + "</groupField>"; } groupItemElement.InnerXml = xmlGroupItemString; if (!String.IsNullOrEmpty(xmlGroupItemString)) { element.AppendChild(groupItemElement); } return(element); }