private static object GenerateDropDownListSourceByConfiguration(DropdownPropertyDataSourceConfigurationElement config) { Type type = config.GetTypeInfo(); MethodInfo mi = type.GetMethod(config.Method); if (mi == null) { throw new System.Reflection.TargetException(string.Format("不能在类型{0}中找到方法{1}", type.FullName, config.Method)); } return(mi.Invoke(config.CreateInstance(), new object[] { })); }
private static object GenerateDropDownListSourceByConfiguration(DropdownPropertyDataSourceConfigurationElement config) { Type type = config.GetTypeInfo(); MethodInfo mi = type.GetMethod(config.Method); if (mi == null) throw new System.Reflection.TargetException(string.Format("不能在类型{0}中找到方法{1}", type.FullName, config.Method)); return mi.Invoke(config.CreateInstance(), new object[] { }); }
internal static EnumTypePropertyDescription GenerateEnumTypePropertyDescription(DropdownPropertyDataSourceConfigurationElement config) { EnumTypePropertyDescription result = new EnumTypePropertyDescription(); result.EnumTypeName = config.Name; DropDownList dr = new DropDownList(); dr.DataTextField = config.BindingText; dr.DataValueField = config.BindingValue; dr.DataSource = GenerateDropDownListSourceByConfiguration(config); dr.DataBind(); foreach (ListItem item in dr.Items) result.Items.Add(new EnumItemPropertyDescription(item)); return result; }
private static object GenerateDropDownListSourceByConfiguration(DropdownPropertyDataSourceConfigurationElement config) { Type type = config.GetTypeInfo(); MethodInfo mi = type.GetMethod(config.Method); (mi != null).FalseThrow("不能在类型{0}中找到方法{1}", type.FullName, config.Method); return mi.Invoke(config.CreateInstance(), new object[] { }); }
internal static EnumTypePropertyDescription GenerateEnumTypePropertyDescription(DropdownPropertyDataSourceConfigurationElement config) { EnumTypePropertyDescription result = new EnumTypePropertyDescription(); result.EnumTypeName = config.Name; DropDownList dr = new DropDownList(); dr.DataTextField = config.BindingText; dr.DataValueField = config.BindingValue; dr.DataSource = GenerateDropDownListSourceByConfiguration(config); dr.DataBind(); foreach (ListItem item in dr.Items) { result.Items.Add(new EnumItemPropertyDescription(item)); } return(result); }