/// <summary> /// Creates new XML document for columns. /// </summary> protected void CreateXML() { string[,] changed = null; XmlDocument xmlDoc = new XmlDocument(); XmlNode xmlRoot = xmlDoc.CreateElement("columns"); xmlDoc.AppendChild(xmlRoot); for (int i = 0; i < ItemSelection1.RightColumListBox.Items.Count; i++) { bool isChanged = false; if (SearchInSelected(Convert.ToInt32(ItemSelection1.RightColumListBox.Items[i].Value)) >= 0) { isChanged = true; changed = SearchInChangedColumnsById(Convert.ToInt32(ItemSelection1.RightColumListBox.Items[i].Value)); if (changed == null) { isChanged = false; } } XmlElement xmlColumn = xmlDoc.CreateElement("column"); // Prepare attributes for "column" node var attributes = new Dictionary <string, string> { { "name", ItemSelection1.RightColumListBox.Items[i].Text }, { "header", (isChanged ? changed[0, 2] : String.Empty) }, { "type", ((isChanged) && (changed[0, 3] != null && changed[0, 3].EqualsCSafe("link", true)) ? "link" : "bound") } }; xmlColumn.AddAttributes(attributes); xmlRoot.AppendChild(xmlColumn); } hdnSelectedColumns.Value = xmlDoc.ToFormattedXmlString(true); }
/// <summary> /// Updates parameters collection of parameters and values according to the values of the inner controls. /// </summary> /// <param name="config">Parameters collection</param> private string UpdateConfiguration(XmlDocument config) { // Create proper XML structure config.LoadXml("<AutoResize><autoresize /><autoresize_width /><autoresize_height /><autoresize_maxsidesize /></AutoResize>"); XmlNode nodeAutoresize = config.SelectSingleNode("AutoResize/autoresize"); XmlNode nodeAutoresizeWidth = config.SelectSingleNode("AutoResize/autoresize_width"); XmlNode nodeAutoresizeHeight = config.SelectSingleNode("AutoResize/autoresize_height"); XmlNode nodeAutoresizeMax = config.SelectSingleNode("AutoResize/autoresize_maxsidesize"); // Save custom settings if (drpSettings.SelectedValue == "custom") { nodeAutoresize.InnerText = "custom"; if (!string.IsNullOrEmpty(txtWidth.Text.Trim())) { nodeAutoresizeWidth.InnerText = txtWidth.Text.Trim(); } if (!string.IsNullOrEmpty(txtHeight.Text.Trim())) { nodeAutoresizeHeight.InnerText = txtHeight.Text.Trim(); } if (!string.IsNullOrEmpty(txtMax.Text.Trim())) { nodeAutoresizeMax.InnerText = txtMax.Text.Trim(); } } // Save no resize settings else if (drpSettings.SelectedValue == "noresize") { nodeAutoresize.InnerText = "noresize"; } return(config.ToFormattedXmlString(true)); }
/// <summary> /// Creates new XML document for columns. /// </summary> protected void CreateXML() { string[,] mChanged = null; XmlDocument xmldoc = new XmlDocument(); XmlNode xmlRoot = xmldoc.CreateElement("columns"); xmldoc.AppendChild(xmlRoot); for (int i = 0; i < ItemSelection1.RightColumListBox.Items.Count; i++) { bool mIsChanged = false; if (SearchInSelected(Convert.ToInt32(ItemSelection1.RightColumListBox.Items[i].Value)) >= 0) { mIsChanged = true; mChanged = SearchInChangedColumnsById(Convert.ToInt32(ItemSelection1.RightColumListBox.Items[i].Value)); if (mChanged == null) { mIsChanged = false; } } XmlElement xmlColumn = xmldoc.CreateElement("column"); // Prepare attributes for "column" node var attributes = new Dictionary<string, string> { { "name", ItemSelection1.RightColumListBox.Items[i].Text }, { "header", (mIsChanged ? mChanged[0, 2] : String.Empty) }, { "type", ((mIsChanged) && (mChanged[0, 3] != null && mChanged[0, 3].EqualsCSafe("link", true)) ? "link" : "bound") } }; xmlColumn.AddAttributes(attributes); xmlRoot.AppendChild(xmlColumn); } hdnSelectedColumns.Value = xmldoc.ToFormattedXmlString(true); }