private void validatingEditors() { if (_editorList == null) { _editorList = new WebDataEditorList(this); } else { int n = FieldCount; StringCollection fieldNames = new StringCollection(); for (int j = 0; j < n; j++) { fieldNames.Add(GetFieldNameByIndex(j).ToLowerInvariant()); } //remove invalid editors StringCollection sc = new StringCollection(); for (int i = 0; i < _editorList.Count; i++) { bool isValid = false; if (!string.IsNullOrEmpty(_editorList[i].ValueField)) { string s = _editorList[i].ValueField.ToLowerInvariant(); isValid = fieldNames.Contains(s); } if (!isValid) { sc.Add(_editorList[i].ValueField); } } for (int i = 0; i < sc.Count; i++) { _editorList.RemoveEditorByName(sc[i]); } //add missing editors for (int j = 0; j < n; j++) { if (_editorList.GetEditorByName(fieldNames[j]) == null) { WebDataEditorNone wn = new WebDataEditorNone(); wn.ValueField = GetFieldNameByIndex(j); _editorList.AddEditor(wn); } } } }
public override void OnReadFromXmlNode(IXmlCodeReader serializer, XmlNode node) { base.OnReadFromXmlNode(serializer, node); string refName = XmlUtil.GetAttribute(node, XML_ATTR_DataSource); if (!string.IsNullOrEmpty(refName)) { XmlObjectReader xr = serializer as XmlObjectReader; if (xr != null) { xr.AddDelayedInitializer(this, node); } } ActionColumnWidth = XmlUtil.GetAttributeInt(node, XML_ATTR_ActColSize); string s = XmlUtil.GetAttribute(node, XML_ATTR_ACTS); if (!string.IsNullOrEmpty(s)) { string[] ss = s.Split(';'); for (int i = 0; i < ss.Length; i++) { ActionControls.AddComponent(ss[i]); } } if (XmlUtil.GetAttributeBoolDefFalse(node, XML_ATT_readonly)) { this.ReadOnly = true; } DatePickerFonstSize = XmlUtil.GetAttributeInt(node, XML_ATT_dpfsize); XmlNodeList nds = node.SelectNodes(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", XML_Editors, XmlTags.XML_Item)); if (nds != null && nds.Count > 0) { WebDataEditor[] eds = new WebDataEditor[nds.Count]; serializer.ReadArray(nds, eds, this); _editorList = new WebDataEditorList(); _editorList.SetFields(this); for (int i = 0; i < eds.Length; i++) { eds[i].SetHolder(this); _editorList.Add(eds[i]); } } Color c = readColor(node, XML_ATT_altColor); if (c != Color.Empty) { _alternateColor = c; } c = readColor(node, XML_ATT_htColor); if (c != Color.Empty) { _highlightCellColor = c; } c = readColor(node, XML_ATT_hrColor); if (c != Color.Empty) { _highlightRowColor = c; } c = readColor(node, XML_ATT_srColor); if (c != Color.Empty) { _selectRowColor = c; } }