private void BindData() { //Bind GridViewCondition GridViewCondition.DataSource = FormFlowBiz.GetConditionSubList(ConditionId).OrderBy(cs => cs.CreateTime); GridViewCondition.DataBind(); //display RadioButtonListJoin if (GridViewCondition.Rows.Count == 0) { RadioButtonListJoin.Enabled = false; RadioButtonListJoin.SelectedIndex = -1; } else { RadioButtonListJoin.SelectedIndex = 0; RadioButtonListJoin.Enabled = true; } //Bind DropDownListField DataTable dt = CommonBiz.GetColumns(string.Format("tb_{0}", FormId)); DropDownListField.DataSource = dt; DropDownListField.DataTextField = "name"; DropDownListField.DataValueField = "name"; DropDownListField.DataBind(); }
private BoundField GetField(IConfigurationElement element) { if (element.Attributes.ContainsKey("type")) { string type = element.Attributes["type"].Value.ToString(); BoundField field; switch (type) { case "Text": { field = new BoundField(); break; } case "Label": { field = new BoundField(); field.ReadOnly = true; break; } case "Date": { field = new DateBoundField(); break; } case "Number": { field = new NumberBoundField(); break; } case "DropDownList": { field = new DropDownListField(); break; } case "CheckBox": case "Check": { field = new CheckBoxField(); break; } case "Hidden": { field = new BoundField(); field.ItemStyle.CssClass = "hidden"; break; } default: { throw new ArgumentException("Unknown grid view field type '" + element.Attributes["type"].Value.ToString() + "'"); } } if (!(field is CheckBoxField)) { field.HtmlEncode = false; } if (element.Attributes.ContainsKey("DataMember")) { field.DataField = element.Attributes["DataMember"].Value.ToString(); } ; if (element.Attributes.ContainsKey("HeaderText")) { field.HeaderText = element.Attributes["HeaderText"].Value.ToString(); } ; if (element.Attributes.ContainsKey("FormatString")) { try { field.DataFormatString = element.Attributes["FormatString"].Value.ToString(); } catch { } } if (field is DropDownListField) { if (element.Attributes.ContainsKey("DataTextField")) { ((DropDownListField)field).DataTextField = element.GetAttributeReference("DataTextField").Value.ToString(); } if (element.Attributes.ContainsKey("DataValueField")) { ((DropDownListField)field).DataValueField = element.GetAttributeReference("DataValueField").Value.ToString(); } } return(field); } return(null); }