private void CreateFieldConfigNode() { if (string.IsNullOrWhiteSpace(FieldsXmlPath)) { Response.Write("请设置FieldXmlPath字段路经"); return; } string xmlFilePath = SysVariable.CurrentContext.Server.MapPath(FieldsXmlPath); XmlDocument _FileConfigXml = new XmlDocument(); _FileConfigXml.Load(xmlFilePath); foreach (XmlNode objXmlNode in _FileConfigXml.SelectNodes("//FieldConfig/Field")) { string WriteType = objXmlNode.ReadAttribute("WriteType", "TextBox"); if (WriteType == "Caption") { Literal objLiteral = new Literal(); objLiteral.Text = "<tr class=\"trCaption\"><td colspan=\"2\">" + objXmlNode.InnerText.Replace("\r\n", "").Trim() + " </td> </tr>"; panControl.Controls.Add(objLiteral); } else if (WriteType == "TextBox") { Control_FieldTextBoxControl objFieldControl = (Control_FieldTextBoxControl)this.LoadControl("/Control/FieldTextBoxControl.ascx"); string Name = objXmlNode.ReadAttribute("Name"); string KeyName = objXmlNode.ReadAttribute("KeyName", Name); objFieldControl.ID = Name; panControl.Controls.Add(objFieldControl); objFieldControl.SetField(objXmlNode); if (_FieldValues != null && _FieldValues.ContainsKey(KeyName)) { objFieldControl.Value = _FieldValues[KeyName]; } } else if (WriteType == "DropDown") { Control_FieldDropDownControl objFieldControl = (Control_FieldDropDownControl)this.LoadControl("/Control/FieldDropDownControl.ascx"); string Name = objXmlNode.ReadAttribute("Name"); string KeyName = objXmlNode.ReadAttribute("KeyName", Name); objFieldControl.ID = Name; panControl.Controls.Add(objFieldControl); if (_ConditionValues != null && _ConditionValues.ContainsKey(Name)) { objFieldControl.Condition = _ConditionValues[Name]; } objFieldControl.SetField(objXmlNode); if (_FieldValues != null && _FieldValues.ContainsKey(KeyName)) { objFieldControl.Value = _FieldValues[KeyName]; } } else if (WriteType == "CheckBoxList") { Control_FieldCheckBoxListControl objFieldControl = (Control_FieldCheckBoxListControl)this.LoadControl("/Control/FieldCheckBoxListControl.ascx"); string Name = objXmlNode.ReadAttribute("Name"); string KeyName = objXmlNode.ReadAttribute("KeyName", Name); objFieldControl.ID = Name; panControl.Controls.Add(objFieldControl); if (_ConditionValues != null && _ConditionValues.ContainsKey(Name)) { objFieldControl.Condition = _ConditionValues[Name]; } objFieldControl.SetField(objXmlNode); if (_FieldValues != null && _FieldValues.ContainsKey(KeyName)) { objFieldControl.Value = _FieldValues[KeyName]; } } else if (WriteType == "RadioList") { Control_FieldRadioButtonListControl objFieldControl = (Control_FieldRadioButtonListControl)this.LoadControl("/Control/FieldRadioButtonListControl.ascx"); string Name = objXmlNode.ReadAttribute("Name"); string KeyName = objXmlNode.ReadAttribute("KeyName", Name); objFieldControl.ID = Name; panControl.Controls.Add(objFieldControl); if (_ConditionValues != null && _ConditionValues.ContainsKey(Name)) { objFieldControl.Condition = _ConditionValues[Name]; } objFieldControl.SetField(objXmlNode); if (_FieldValues != null && _FieldValues.ContainsKey(KeyName)) { objFieldControl.Value = _FieldValues[KeyName]; } } else if (WriteType == "CheckBox") { Control_FieldCheckBoxControl objFieldControl = (Control_FieldCheckBoxControl)this.LoadControl("/Control/FieldCheckBoxControl.ascx"); string Name = objXmlNode.ReadAttribute("Name"); string KeyName = objXmlNode.ReadAttribute("KeyName", Name); objFieldControl.ID = Name; panControl.Controls.Add(objFieldControl); objFieldControl.SetField(objXmlNode); if (_FieldValues != null && _FieldValues.ContainsKey(KeyName)) { objFieldControl.Value = _FieldValues[KeyName]; } } } }