private void WriteXaxisSectionHtml(HtmlTextWriter output) { output.Write("<b>X Axis</b><br>"); XaxisFieldDropDownList.RenderControl(output); output.Write("</td></tr><tr><td>"); if (!IsBubbleChart()) { output.Write("Aggregation Type<br>"); AggregateTypeHtmlSelect.RenderControl(output); output.Write("<br></td></tr><tr><td>"); } output.Write("</td></tr></table>"); output.Write("</div>"); }
protected void GenerateProductTypePropertyFields() { ProductTypePropertiesLiteral.Text = ""; if (lstProductType.SelectedValue.Trim() != string.Empty) { string productTypeBvin = lstProductType.SelectedValue; List <ProductProperty> props = MTApp.CatalogServices.ProductPropertiesFindForType(productTypeBvin); StringBuilder sb = new StringBuilder(); int count = 0; foreach (ProductProperty item in props) { count += 1; StringWriter sw = new StringWriter(); HtmlTextWriter writer = new HtmlTextWriter(sw); sb.Append("<tr><td class=\"formlabel\">"); sb.Append(item.DisplayName); sb.Append("</td><td class=\"formfield\">"); if (item.TypeCode == ProductPropertyType.CurrencyField) { HtmlInputText input = new HtmlInputText(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.DateField) { HtmlInputText input = new HtmlInputText(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.HyperLink) { HtmlInputText input = new HtmlInputText(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.MultipleChoiceField) { HtmlSelect input = new HtmlSelect(); input.ID = "ProductTypeProperty" + count.ToString(); bool setWidth = false; foreach (ProductPropertyChoice choice in item.Choices) { if (choice.ChoiceName.Length > 25) { setWidth = true; } System.Web.UI.WebControls.ListItem li = new System.Web.UI.WebControls.ListItem(choice.ChoiceName, choice.Id.ToString()); input.Items.Add(li); } if (setWidth) { input.Style.Add("width", "305px"); } if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } else if (item.TypeCode == ProductPropertyType.TextField) { HtmlTextArea input = new HtmlTextArea(); input.ID = "ProductTypeProperty" + count.ToString(); if (ProductTypeProperties.Count > (count - 1)) { if (ProductTypeProperties[count - 1] != null) { input.Value = ProductTypeProperties[count - 1]; } else { input.Value = item.DefaultValue; } } else { input.Value = item.DefaultValue; } input.Rows = 5; input.Cols = 40; input.RenderControl(writer); writer.Flush(); sb.Append(sw.ToString()); } sb.Append("</td></tr>"); ProductTypePropertiesLiteral.Text = sb.ToString(); } } }
private string GeneratePropertyControl(ProductProperty item, string propertyValue) { using (var sw = new StringWriter()) { using (var writer = new HtmlTextWriter(sw)) { if (item.TypeCode == ProductPropertyType.CurrencyField) { var input = new HtmlInputText(); input.ID = "ProductTypeProperty" + item.Id; if (propertyValue != null) { input.Value = propertyValue; } else { input.Value = item.DefaultValue; } input.RenderControl(writer); } else if (item.TypeCode == ProductPropertyType.DateField) { var input = new HtmlInputText(); input.ID = "ProductTypeProperty" + item.Id; if (propertyValue != null) { input.Value = propertyValue; } else { input.Value = item.DefaultValue; } input.RenderControl(writer); } else if (item.TypeCode == ProductPropertyType.HyperLink) { var input = new HtmlInputText(); input.ID = "ProductTypeProperty" + item.Id; if (propertyValue != null) { input.Value = propertyValue; } else { input.Value = item.DefaultValue; } input.RenderControl(writer); } else if (item.TypeCode == ProductPropertyType.MultipleChoiceField) { var input = new HtmlSelect(); input.ID = "ProductTypeProperty" + item.Id; foreach (var choice in item.Choices) { var li = new ListItem(choice.DisplayName, choice.Id.ToString()); input.Items.Add(li); } if (propertyValue != null) { input.Value = propertyValue; } else { input.Value = item.DefaultValue; } input.RenderControl(writer); } else if (item.TypeCode == ProductPropertyType.TextField) { var input = new HtmlTextArea(); input.ID = "ProductTypeProperty" + item.Id; var defaultValue = item.IsLocalizable ? item.DefaultLocalizableValue : item.DefaultValue; if (propertyValue != null) { input.Value = propertyValue; } else { input.Value = defaultValue; } input.Rows = 5; input.Cols = 40; input.RenderControl(writer); } else if (item.TypeCode == ProductPropertyType.FileUpload) { //TODO: } writer.Flush(); return(sw.ToString()); } } }
/// <summary> /// Renders the contents of the control to the specified writer. This method is used primarily by control developers. /// </summary> /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param> protected override void RenderContents(HtmlTextWriter writer) { if (writer == null) { throw new ArgumentNullException("writer", "writer cannot be a null reference (Nothing in Visual Basic)!"); } // start the row writer.RenderBeginTag(HtmlTextWriterTag.Tr); // Add Labels writer.RenderBeginTag(HtmlTextWriterTag.Td); // First TD writer.Write(AllItemsText); writer.RenderEndTag(); // end the td writer.RenderBeginTag(HtmlTextWriterTag.Td); // second TD writer.Write(" "); writer.RenderEndTag(); // end the td writer.RenderBeginTag(HtmlTextWriterTag.Td); // third TD writer.Write(SelectedItemsText); writer.RenderEndTag(); // end the td if (DestinationSortable && !SortOnChange) { writer.RenderBeginTag(HtmlTextWriterTag.Td); // 4th TD to contain the move up/down when changing order //writer.Write(SelectedItemsText); writer.RenderEndTag(); // end the td } writer.RenderEndTag(); // end the tr // start the next row writer.RenderBeginTag(HtmlTextWriterTag.Tr); // begin the first cell writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top"); // set the alignment to top writer.RenderBeginTag(HtmlTextWriterTag.Td); // All list box using (HtmlSelect mySelect = new HtmlSelect()) { mySelect.Multiple = true; mySelect.Attributes.Add("Style", "width: " + Size + "px"); mySelect.Size = int.Parse(Rows.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); mySelect.ID = ClientID + "_SrcList"; foreach (var _item in m_AllItems) { ListItem myItem = new ListItem(_item.ToString(), _item.ToString()); myItem.Attributes.Add("title", _item.ToString()); mySelect.Items.Add(myItem); } //writer.Write(String.Format("<option value=""{0}"">{0}</option>", item)) mySelect.RenderControl(writer); } // end the first cell writer.RenderEndTag(); // begin the second cell writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top"); writer.RenderBeginTag(HtmlTextWriterTag.Td); // begin the second cell // Add Button using (HtmlInputButton myButton = new HtmlInputButton()) { myButton.Value = m_SelectButtonText; myButton.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "GW.ListPicker.switchList(this.form.{0}_SrcList, this.form.{0}_DstList,'{1}')", ClientID, SortOnChange)); myButton.Attributes.Add("class", "listPickerArrow"); myButton.Attributes.Add("style", "width: " + m_ButtonWidth); myButton.RenderControl(writer); } writer.WriteBreak(); using (HtmlInputButton myButton = new HtmlInputButton()) { myButton.Value = m_SelectAllButtonText; myButton.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "GW.ListPicker.switchAll(this.form.{0}_SrcList, this.form.{0}_DstList,'{1}')", ClientID, SortOnChange)); myButton.Attributes.Add("class", "listPickerArrow"); myButton.Attributes.Add("style", "width: " + m_ButtonWidth); myButton.RenderControl(writer); } writer.WriteBreak(); using (HtmlInputButton myButton = new HtmlInputButton()) { myButton.Value = m_DeSelectButtonText; myButton.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "GW.ListPicker.switchList(this.form.{0}_DstList, this.form.{0}_SrcList,'true')", ClientID)); myButton.Attributes.Add("class", "listPickerArrow"); myButton.Attributes.Add("style", "width: " + m_ButtonWidth); myButton.RenderControl(writer); } writer.WriteBreak(); using (HtmlInputButton myButton = new HtmlInputButton()) { myButton.Value = m_DeSelectAllButtonText; myButton.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "GW.ListPicker.switchAll(this.form.{0}_DstList, this.form.{0}_SrcList,'true')", ClientID)); myButton.Attributes.Add("class", "listPickerArrow"); myButton.Attributes.Add("style", "width: " + ButtonWidth); myButton.RenderControl(writer); } writer.RenderEndTag(); // end the second cell writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top"); writer.RenderBeginTag(HtmlTextWriterTag.Td); //begin third cell using (HtmlSelect mySelect = new HtmlSelect()) { mySelect.Multiple = true; mySelect.Attributes.Add("Style", "width: " + Size + "px"); mySelect.Size = int.Parse(Rows.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture); mySelect.ID = ClientID + "_DstList"; foreach (var _item in m_SelectedItems) { ListItem myItem = new ListItem(_item.ToString(), _item.ToString()); mySelect.Items.Add(myItem); } //writer.Write(String.Format("<option value=""{0}"">{0}</option>", item)) mySelect.RenderControl(writer); } writer.RenderEndTag();// end third cell if (DestinationSortable && !SortOnChange) { writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top"); writer.RenderBeginTag(HtmlTextWriterTag.Td);// add the 4th td using (HtmlInputButton myButton = new HtmlInputButton()) { myButton.Value = "▲"; myButton.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "GW.ListPicker.moveUp(this.form.{0}_DstList)", ClientID)); myButton.Attributes.Add("class", "listPickerArrow"); myButton.Attributes.Add("style", "width: " + m_ButtonWidth); myButton.RenderControl(writer); } writer.WriteBreak(); using (HtmlInputButton myButton = new HtmlInputButton()) { myButton.Value = "▼"; myButton.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "GW.ListPicker.moveDown(this.form.{0}_DstList)", ClientID)); myButton.Attributes.Add("class", "listPickerArrow"); myButton.Attributes.Add("style", "width: " + m_ButtonWidth); myButton.RenderControl(writer); } writer.WriteBreak(); writer.RenderEndTag(); } writer.RenderEndTag();// end the tr }