使用方法

前台页面这样写就足够了

<form class="stdform" runat="server"><div id="field_tab_content" runat="server"></div>
</form>

新增编辑加载页面(改页面需要继承CreateModel类)

Type type;
public decimal id = 0;
protected void Page_Init(object sernder, EventArgs e)
{//初始化类型this.XTYPE = new S_NARTICLE();S_NARTICLE pros = new S_NARTICLE();decif (!string.IsNullOrEmpty(Request["id"])){id = Convert.ToDecimal(Request["id"]);if(id>0){//通过id获取项目信息XTYPE = data.S_NARTICLE.FirstOrDefault(p => p.ARTID == id);}}//设置特殊字段fileds.Add(new FiledInfo() { FiledName = "PID", IsHide = true });//设置下拉列表数据//设置下拉类表选项List<DictionaryEntry> industriesTypeList = new List<DictionaryEntry>();industriesTypeList.Add(new DictionaryEntry("是", "T"));industriesTypeList.Add(new DictionaryEntry("否", "F"));    SpecialControls.Add(new EditPageControl() { CType = ContorlType.select, FiledName ="字段名称", Value = industriesTypeList});this.CreateData1(type);field_tab_content.Controls.Add(Cache[type.Name + "htmlDD"] as Control);
}

View Code

保存页面

protected void btnSave_Click(object sender, EventArgs e)
{this.Save1(field_tab_content, type, XTYPE);S_NARTICLE project = XTYPE as S_NARTICLE;if (project.ARTID == 0){//新增操作//特殊字段处理。。。。}else{//修改操作//特殊字段处理。。。。}
}

View Code

CreateModel类

public class CreateModel : System.Web.UI.Page
{public object XTYPE; public List<FiledInfo> fileds = new List<FiledInfo>();//设置属性public List<EditPageControl> SpecialControls = new List<EditPageControl>();//设置属性public List<L_CATTACHMENT> filelist = new List<L_CATTACHMENT>();//附件信息 public StringBuilder text = new StringBuilder();public bool isReadonly = false;public bool isAllalien = false;
//创建表单内容文件
public void NewList(Type type){HtmlGenericControl htmlDD = new HtmlGenericControl("div");htmlDD.Attributes.Add("class", "boxcontents procontent");if (Cache["" + type.Name + ""] == null){//获取数据oracle数据库中的字段名称和备注DataSet ds = DbHelperOleDb.GetListBySql("select table_name,column_Name,Comments from user_col_comments where table_name='" + type.Name + "'");Cache["" + type.Name + ""] = ds;}if (Cache["" + type.Name + ""] != null){foreach (DataRow item in (Cache["" + type.Name + ""] as DataSet).Tables[0].Rows){//没有预置的字段if (fileds.Count == 0 || fileds.Count(p => p.FiledName.ToUpper() == item["column_Name"].ToString()) == 0){fileds.Add(new FiledInfo() { FiledName = item["column_Name"].ToString(), FiledDesc = item["Comments"].ToString(), Index = 0 });}else{var f = fileds.FirstOrDefault(p => p.FiledName.ToUpper() == item["column_Name"].ToString());if (f != null)f.FiledDesc = item["Comments"].ToString();}}fileds = fileds.OrderBy(p => p.Index).ToList();foreach (var filed in fileds){//隐藏字段不处理if (filed.IsHide)continue;//设置占全行if (isAllalien){filed.AllLine = isAllalien;}#region  boxdiv设置表单每项的外部样式HtmlGenericControl boxdiv = new HtmlGenericControl("div");//boxdivvar boxdivclass = ConfigurationManager.AppSettings["boxdiv"];if (!string.IsNullOrEmpty(boxdivclass)){boxdiv.Attributes.Add("class", boxdivclass);}else{boxdiv.Attributes.Add("class", "listitem form-group");}#region boxChildlabelHtmlGenericControl boxChildlabel = new HtmlGenericControl("label");//boxChildlabelvar boxChildlabelclass = ConfigurationManager.AppSettings["boxChildlabel"];if (!string.IsNullOrEmpty(boxChildlabelclass)){boxChildlabel.Attributes.Add("class", boxChildlabelclass);}else{boxChildlabel.Attributes.Add("class", "listleft titles");}boxChildlabel.InnerText = filed.FiledDesc + ":";#endregionHtmlGenericControl boxChilddiv = new HtmlGenericControl("div");//boxChilddivvar boxChilddivclass = ConfigurationManager.AppSettings["boxChilddiv"];if (!string.IsNullOrEmpty(boxChilddivclass)){boxChilddiv.Attributes.Add("class", boxChilddivclass);}else{boxChilddiv.Attributes.Add("class", "listleft con");}PropertyInfo cons = type.GetProperty(filed.FiledName);#endregionvar specialContorl = SpecialControls.FirstOrDefault(p => p.FiledName.ToLower() == filed.FiledName.ToLower());if (specialContorl == null){specialContorl = SpecialControls.FirstOrDefault(p => p.FiledName.ToUpper() == filed.FiledName.ToUpper());}if (specialContorl != null){#region 处理特殊控件switch (specialContorl.CType){case ContorlType.checkbox:CheckBoxList dts = new CheckBoxList();dts.ID = "S_" + filed.FiledName;dts.RepeatDirection = RepeatDirection.Horizontal;dts.RepeatColumns = 4;filed.AllLine = true;if (specialContorl.Value != null){foreach (var item in specialContorl.Value as List<DictionaryEntry>){dts.Items.Add(new ListItem() { Text = item.Key + "", Value = item.Value + "" });}}dts.Enabled = !isReadonly;//只读显示HtmlGenericControl spandts = new HtmlGenericControl("span");spandts.InnerText = "{{project." + filed.FiledName.ToLower() + "}}";spandts.Attributes.Add("v-show", "isshow");#region 多选按钮样式var checkboxclass = ConfigurationManager.AppSettings[ContorlType.checkbox.ToString()];if (!string.IsNullOrEmpty(checkboxclass)){dts.Attributes.Add("class", checkboxclass);}else{dts.Attributes.Add("class", "");}if (!string.IsNullOrEmpty(specialContorl.thisclass)){dts.Attributes.Add("class", specialContorl.thisclass);}#endregionif (isReadonly){boxChilddiv.Controls.Add(spandts);}else{boxChilddiv.Controls.Add(dts);}break;case ContorlType.select:DropDownList ddl = new DropDownList();ddl.ID = "S_" + filed.FiledName;ddl.Enabled = !isReadonly;if (filed.Readonly){ddl.Enabled = false;}string selectname = "";if (specialContorl.Value != null){var items = specialContorl.Value as List<DictionaryEntry>;ddl.DataSource = items;ddl.DataValueField = "value";ddl.DataTextField = "key";ddl.DataBind();ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(cons.GetValue(XTYPE) + ""));if (filed.FiledDesc == "采购人角色" || filed.FiledDesc == "采购代理机构角色"){ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue("04"));}var selvalu = cons.GetValue(XTYPE);var po = items.FirstOrDefault(x => x.Value == selvalu);selectname = ddl.SelectedItem.Text;}HtmlGenericControl spandtsd = new HtmlGenericControl("span");//spandtsd.InnerText = "{{project." + filed.FiledName.ToLower() + "}}" + selectname;spandtsd.InnerText = selectname;spandtsd.Attributes.Add("v-show", "isshow");ddl.Attributes.Add("style", "width:98%;");#region 下拉列表样式设置var selectclass = ConfigurationManager.AppSettings[ContorlType.select.ToString()];if (!string.IsNullOrEmpty(selectclass)){ddl.Attributes.Add("class", selectclass);}else{ddl.Attributes.Add("class", "");}if (!string.IsNullOrEmpty(specialContorl.thisclass)){ddl.Attributes.Add("class", specialContorl.thisclass);}#endregionif (isReadonly){boxChilddiv.Controls.Add(spandtsd);}else{boxChilddiv.Controls.Add(ddl);}break;case ContorlType.FontColor:HtmlTextArea txtTextArea1s = new HtmlTextArea();txtTextArea1s.ID = "S_" + filed.FiledName;txtTextArea1s.InnerText = cons.GetValue(XTYPE) + "";#region 字体样式设置var FontColorclass = ConfigurationManager.AppSettings[ContorlType.FontColor.ToString()];if (!string.IsNullOrEmpty(FontColorclass)){txtTextArea1s.Attributes.Add("class", FontColorclass);}else{txtTextArea1s.Attributes.Add("class", "");}if (!string.IsNullOrEmpty(specialContorl.thisclass)){txtTextArea1s.Attributes.Add("class", specialContorl.thisclass);}#endregionif (isReadonly){txtTextArea1s.Attributes.Add("readOnly", isReadonly + "");}HtmlGenericControl sp = new HtmlGenericControl("span");sp.InnerText = "{{project." + filed.FiledName.ToLower() + "}}";sp.Attributes.Add("v-show", "isshow");if (isReadonly){boxChilddiv.Controls.Add(sp);}elseboxChilddiv.Controls.Add(txtTextArea1s);break;case ContorlType.uedit:HtmlTextArea txtTextArea1 = new HtmlTextArea();txtTextArea1.ID = "S_" + filed.FiledName;txtTextArea1.Attributes.Add("class", "show");txtTextArea1.InnerText = cons.GetValue(XTYPE) + "";filed.AllLine = true;#region 编辑器设置var ueditclass = ConfigurationManager.AppSettings[ContorlType.uedit.ToString()];if (!string.IsNullOrEmpty(ueditclass)){txtTextArea1.Attributes.Add("class", ueditclass);}else{txtTextArea1.Attributes.Add("class", "");}if (!string.IsNullOrEmpty(specialContorl.thisclass)){txtTextArea1.Attributes.Add("class", specialContorl.thisclass);}if (isReadonly){txtTextArea1.Attributes.Add("readOnly", isReadonly + "");}HtmlGenericControl ssp = new HtmlGenericControl("span");ssp.InnerText = "{{project." + filed.FiledName.ToLower() + "}}";ssp.Attributes.Add("v-show", "isshow");if (isReadonly){boxChilddiv.Controls.Add(ssp);}elseboxChilddiv.Controls.Add(txtTextArea1);#endregionbreak;case ContorlType.fileUpload:TextBox box = new TextBox();box.ID = "S_" + filed.FiledName;box.Text = cons.GetValue(XTYPE) + "";if (!isReadonly){box.Attributes.Add("class", "input code input normal upload-path");}box.Attributes.Add("style", "width:82%");HtmlGenericControl imgdiv = new HtmlGenericControl("div");HtmlGenericControl ssps = new HtmlGenericControl("span");ssps.InnerText = "{{project." + filed.FiledName.ToLower() + "}}";ssps.Attributes.Add("v-show", "isshow");#region 文件上传样式设置var fileUploadclass = ConfigurationManager.AppSettings[ContorlType.fileUpload.ToString()];if (!string.IsNullOrEmpty(fileUploadclass)){box.Attributes.Add("class", fileUploadclass);}else{box.Attributes.Add("class", "upload-box upload-img");}if (!string.IsNullOrEmpty(specialContorl.thisclass)){box.Attributes.Add("class", specialContorl.thisclass);}if (!isReadonly){imgdiv.Attributes.Add("class", "upload-box upload-img");}box.ReadOnly = isReadonly;if (isReadonly){boxChilddiv.Controls.Add(ssps);}else{boxChilddiv.Controls.Add(box);}#endregionbreak;case ContorlType.fileUploadmore:HtmlGenericControl boxd = new HtmlGenericControl();boxd.ID = "S_" + filed.FiledName;var filecontent = cons.GetValue(XTYPE) + "";HtmlGenericControl imgdivs = new HtmlGenericControl("div");imgdivs.Attributes.Add("class", "photo-list");HtmlGenericControl ul = new HtmlGenericControl("ul");#region 添加相应的内容//获取相应的内容  并将值赋值到相应的控件上if (!string.IsNullOrEmpty(filecontent)){var name = filecontent;//基本信息if (!string.IsNullOrEmpty(name)){List<decimal?> Pids = new List<decimal?>();string[] AllPid = name.Trim(',').Split(',');for (int i = 0; i < AllPid.Length; i++){HtmlGenericControl li = new HtmlGenericControl("li");var da = Convert.ToDecimal(AllPid[i]);var filemodel = filelist.FirstOrDefault(x => x.ATTACHMENTID == da);if (filemodel != null){HtmlGenericControl hid_photo_name = new HtmlGenericControl("input");hid_photo_name.Attributes.Add("name", "hid_photo_name" + filed.FiledName);hid_photo_name.Attributes.Add("type", "hidden");hid_photo_name.Attributes.Add("value", "" + filemodel.ATTACHMENTID + "|" + filemodel.FILEOLDNAME + "|" + filemodel.FILESIZE + "|" + filemodel.FILEPATH + "|" + filemodel.FILEPATH + "");HtmlGenericControl hid_photo_remark = new HtmlGenericControl("input");hid_photo_remark.Attributes.Add("name", "hid_photo_remark" + filed.FiledName);hid_photo_remark.Attributes.Add("type", "hidden");hid_photo_remark.Attributes.Add("value", filemodel.FILEOLDNAME);HtmlGenericControl contentdiv = new HtmlGenericControl("div");contentdiv.Attributes.Add("class", "img-box");contentdiv.Attributes.Add("style", "height:25px;");//contentdiv.Attributes.Add("onclick", "setFocusImg(this);");//HtmlGenericControl contentspan = new HtmlGenericControl("span");HtmlGenericControl contentspan = new HtmlGenericControl("a");contentspan.Attributes.Add("class", "remark");contentspan.Attributes.Add("href", filemodel.FILEPATH);//<a target="_blank"></a>contentspan.Attributes.Add("target", "_blank");HtmlGenericControl contenti = new HtmlGenericControl("i");contenti.InnerText = filemodel.FILEREMARK == "" ? filemodel.FILEOLDNAME : filemodel.FILEREMARK;contentspan.Controls.Add(contenti);contentdiv.Controls.Add(contentspan);//HtmlGenericControl remarda = new HtmlGenericControl("a");//remarda.InnerText = "描述";//remarda.Attributes.Add("href", "javascript:;");//remarda.Attributes.Add("onclick", "setRemark(this);");//HtmlGenericControl del = new HtmlGenericControl("a");//del.InnerText = "删除";//del.Attributes.Add("href", "javascript:;");//del.Attributes.Add("onclick", "delImg(this);");li.Controls.Add(hid_photo_name);//基本信息li.Controls.Add(hid_photo_remark);//备注 li.Controls.Add(contentdiv);//备注//li.Controls.Add(remarda);//备注//li.Controls.Add(del);//删除
                                                ul.Controls.Add(li);}}}}#endregionimgdivs.Controls.Add(ul);boxChilddiv.Controls.Add(boxd);HtmlGenericControl sspsd = new HtmlGenericControl("span");sspsd.InnerText = "{{project." + filed.FiledName.ToLower() + "}}";sspsd.Attributes.Add("v-show", "isshow");//if (isReadonly)//{//    boxChilddiv.Controls.Add(sspsd);//}//else#region 文件上传样式设置var fileUploadmoreclass = ConfigurationManager.AppSettings[ContorlType.fileUploadmore.ToString()];if (!string.IsNullOrEmpty(fileUploadmoreclass)){boxd.Attributes.Add("class", fileUploadmoreclass);}if (!string.IsNullOrEmpty(specialContorl.thisclass)){boxd.Attributes.Add("class", specialContorl.thisclass);}if (!isReadonly){boxd.Attributes.Add("class", "upload-box upload-album");boxd.Attributes.Add("value", filecontent + "");}#endregionboxChilddiv.Controls.Add(imgdivs);break;default:break;}#endregion}else{#region 处理一般控件PropertyInfo con = type.GetProperty(filed.FiledName);if (con != null){var valtype = con.PropertyType;if (valtype.IsGenericType && valtype.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))//判断convertsionType是否为nullable泛型类
                            {//如果type为nullable类,声明一个NullableConverter类,该类提供从Nullable类到基础基元类型的转换  System.ComponentModel.NullableConverter nullableConverter = new System.ComponentModel.NullableConverter(valtype);//将type转换为nullable对的基础基元类型  valtype = nullableConverter.UnderlyingType;}TextBox txtControl = new TextBox();if (valtype.Name == "Decimal" || valtype.Name == "Single"){filed.IsRequired = true;filed.VerificationStrType = VerificationStr.decmilnumber;//txtControl.Attributes.Add("type", "number");txtControl.CssClass = "mediuminput";txtControl.Text = "0";//设置初始值
                            }else if (valtype.Name == "DateTime"){filed.VerificationStrType = VerificationStr.checkFullTime;txtControl.CssClass = "laydate-icon";if (!isReadonly){if (filed.FiledName == "PUBTIME"){txtControl.Attributes.Add("onclick", "laydate({istime: true, format: 'YYYY-MM-DD'})");}else{txtControl.Attributes.Add("onclick", "laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})");}}//txtControl.Attributes.Add("style", "width:91%;float:left");
}else{txtControl.CssClass = "mediuminput";}txtControl.ReadOnly = isReadonly;//设置idtxtControl.ID = "S_" + filed.FiledName.ToString();//赋值if (XTYPE != null){txtControl.Text = cons.GetValue(XTYPE) + "";if (filed.FiledName == "STOPTIME"){txtControl.Attributes.Add("placeholder", "不填写永久显示");txtControl.Text = cons.GetValue(XTYPE) + "" == "" ? "9999/12/31" : cons.GetValue(XTYPE) + "";}}if (filed.Readonly){txtControl.ReadOnly = true;}if (filed.FiledName == "PASSWORD"){txtControl.TextMode = TextBoxMode.Password;//设置密码框
                            }txtControl.Attributes.Add("tipmsg", filed.FiledDesc);//设置属性if (filed.FiledName == "PASSWORD"){txtControl.TextMode = TextBoxMode.Password;//设置密码框
}HtmlGenericControl sspsdd = new HtmlGenericControl("span");sspsdd.InnerText = "{{project." + filed.FiledName.ToLower() + "}}";sspsdd.Attributes.Add("v-show", "isshow");txtControl.Attributes.Add("v-model", "project." + filed.FiledName.ToLower() + "");#region 设置文本框样式var fileUploadmoreclass = ConfigurationManager.AppSettings["input"];if (!string.IsNullOrEmpty(fileUploadmoreclass)){txtControl.CssClass = fileUploadmoreclass;}if (!string.IsNullOrEmpty(filed.thisclass)){txtControl.CssClass = filed.thisclass;}//设置文本框类型switch (filed.inputtpe){case Inputtype.text:case Inputtype.password:case Inputtype.datetime:case Inputtype.date:case Inputtype.month:case Inputtype.time:case Inputtype.week:case Inputtype.number:case Inputtype.email:case Inputtype.url:case Inputtype.search:case Inputtype.tel:case Inputtype.color:txtControl.Attributes.Add("type", filed.inputtpe.ToString());break;default:break;}#endregionif (isReadonly){boxChilddiv.Controls.Add(sspsdd);}elseboxChilddiv.Controls.Add(txtControl);}#endregion}if (filed.IsRequired){HtmlGenericControl error = new HtmlGenericControl("span");error.Attributes.Add("title", filed.errormessage);//添加提示信息 error.Attributes.Add("type", filed.VerificationStrType + "");//添加提示信息error.InnerText = "*";error.Attributes.Add("style", "color:red;position: absolute;left: 0;folat:left");boxChilddiv.Controls.Add(error);}boxdiv.Controls.Add(boxChildlabel);boxdiv.Controls.Add(boxChilddiv);htmlDD.Controls.Add(boxdiv);}}Cache[type.Name + "htmlDD"] = htmlDD;}
//获取值
public void Save1(HtmlGenericControl field_tab_content, Type type, object XTYPE){#region 赋值foreach (var filed in fileds){//取到属性PropertyInfo property = type.GetProperty(filed.FiledName.ToUpper());if (property != null){var valtype = property.PropertyType;if (valtype.IsGenericType && valtype.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))//判断convertsionType是否为nullable泛型类
                    {//如果type为nullable类,声明一个NullableConverter类,该类提供从Nullable类到基础基元类型的转换  System.ComponentModel.NullableConverter nullableConverter = new System.ComponentModel.NullableConverter(valtype);//将type转换为nullable对的基础基元类型  valtype = nullableConverter.UnderlyingType;}var specialContorl = SpecialControls.FirstOrDefault(p => p.FiledName.ToLower() == filed.FiledName.ToLower());if (specialContorl != null){#region 特殊控件取值switch (specialContorl.CType){case ContorlType.select:DropDownList ddl = field_tab_content.FindControl("S_" + filed.FiledName) as DropDownList;if (ddl != null){var ddlVal = ddl.SelectedItem.Value.Trim();if (ddlVal != "")property.SetValue(XTYPE, Convert.ChangeType(ddlVal, valtype), null);}break;case ContorlType.fileUpload:TextBox text = field_tab_content.FindControl("S_" + filed.FiledName) as TextBox; string fileNames = text.Text.Trim();HiddenField hidFileNames = field_tab_content.FindControl("S_HID_" + filed.FiledName) as HiddenField;if (hidFileNames != null)property.SetValue(XTYPE, Convert.ChangeType(hidFileNames.Value + fileNames.Trim(';'), valtype), null);elseproperty.SetValue(XTYPE, Convert.ChangeType(fileNames.Trim(';'), valtype), null);break;case ContorlType.fileUploadmore:break;case ContorlType.uedit:case ContorlType.FontColor:HtmlTextArea txtControls = field_tab_content.FindControl("S_" + filed.FiledName) as HtmlTextArea;var ueditVal = txtControls.InnerText;property.SetValue(XTYPE, Convert.ChangeType(ueditVal, valtype), null);break;}#endregion}else{//一般控件取值TextBox txtControl = field_tab_content.FindControl("S_" + filed.FiledName) as TextBox;if (txtControl != null){var val = txtControl.Text.Trim();//txtControl.Text.Trim();decimal dl = 0;DateTime dt;if (valtype.Name == "Decimal" || valtype.Name == "Single"){if (decimal.TryParse(val, out dl)){val = dl.ToString();property.SetValue(XTYPE, Convert.ChangeType(val, valtype), null);}}else if (valtype.Name == "DateTime"){if (DateTime.TryParse(val, out dt)){val = dt.ToString();property.SetValue(XTYPE, Convert.ChangeType(val, valtype), null);}}else{property.SetValue(XTYPE, Convert.ChangeType(val, valtype), null);}}}}}#endregion}
}

View Code

需要用到的类和枚举

FiledInfo类

public class FiledInfo{/// <summary>/// 字段名/// </summary>public string FiledName { get; set; }/// <summary>/// 字段描述/// </summary>public string FiledDesc { get; set; }/// <summary>/// 在界面中的排序/// </summary>public double Index { get; set; }/// <summary>/// 是否只读/// </summary>[DefaultValue(false)]public bool Readonly { get; set; }/// <summary>/// 是否隐藏/// </summary>[DefaultValue(false)]public bool IsHide { get; set; }/// <summary>/// 是否占全行/// </summary>[DefaultValue(false)]public bool AllLine { get; set; }/// <summary>/// 是否为空/// </summary>public bool IsRequired { get; set; }/// <summary>/// 验证类型/// </summary>public VerificationStr VerificationStrType { get; set; }/// <summary>/// 提示信息/// </summary>public string errormessage { get; set; }/// <summary>/// 显示位置/// </summary>public ItemAlign itemalign { get; set; }/// <summary>/// 设置样式/// </summary>public string thisclass { get; set; }/// <summary>/// 文本框类型/// </summary>public Inputtype inputtpe { get; set; }}

FiledInfo

EditPageControl类

public class EditPageControl{/// <summary>/// 字段名/// </summary>public string FiledName { get; set; }/// <summary>/// 控件类型/// </summary>public ContorlType CType { get; set; }/// <summary>/// 取值/// </summary>public object Value { get; set; }/// <summary>/// 设置样式/// </summary>public string thisclass { get; set; }}

EditPageControl

枚举

public enum Inputtype{//,datetime-localtext, password, datetime, date, month, time, week, number, email, url, search, tel, color}public enum ItemAlign{Left,Right,Top,Bottom}/// <summary>/// 验证/// </summary>public enum VerificationStr{/// <summary>/// 是否为空/// </summary>isnull,/// <summary>/// 电话号码验证/// </summary>phone,/// <summary>/// 密码验证/// </summary>password,/// <summary>/// 邮箱验证/// </summary>email,/// <summary>/// 字母和数字/// </summary>Lettersandnumbers,/// <summary>/// 字母/// </summary>Letters,/// <summary>/// 数字/// </summary>intnumbers,/// <summary>/// 浮点数/// </summary>decmilnumber,/// <summary>/// 时间验证2007-06-05 10:57:10/// </summary>checkFullTime,/// <summary>/// 时间验证 10:57:10/// </summary>checkTime,/// <summary>/// 时间验证  2007-06-05/// </summary>checkDate,/// <summary>/// 身份证号码验证/// </summary>card,/// <summary>/// 整型数据验证/// </summary>checkInteger,/// <summary>/// 固定电话号码 验证/// </summary>checkTelephone,/// <summary>/// QQ号码验证/// </summary>checkQQ,/// <summary>/// 外部链接地址验证/// </summary>checkURL,/// <summary>/// 金额类型/// </summary>isMoney
}public enum ContorlType{/// <summary>/// 下拉列表/// </summary>select,/// <summary>/// 编辑器/// </summary>uedit,/// <summary>/// 文件上传/// </summary>fileUpload,/// <summary>/// 文本域/// </summary>textarea,/// <summary>/// 复选框/// </summary>checkbox,/// <summary>/// 设置字体颜色/// </summary>FontColor,/// <summary>/// 多文件上传/// </summary>fileUploadmore}

枚举

可能会用到的配置文件AppSettings.config

<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<!--设置自动生成表单样式--><!-- <input name="S_PROJECTCODE" type="text" id="S_PROJECTCODE" tipmsg="招标项目编号" class="mediuminput">--><!--mediuminput--><!--bootstrap表单设置  input:form-control--><!--下拉框--><add key="select" value=""/><!--文件上传--><add key="fileUpload" value=""/><!--多行文本框--><add key="textarea" value=""/><!--编辑器--><add key="uedit" value=""/><!--复选框--><add key="checkbox" value=""/><!--字体颜色--><add key="FontColor" value=""/><!--多文件上传--><add key="fileUploadmore" value=""/><add key="input" value=""/><!--每项格式--><!--<div class="listitem form-group"><label class="listleft titles">招标项目编号:</label><div class="listleft con"><input name="S_PROJECTCODE" type="text" id="S_PROJECTCODE" tipmsg="招标项目编号" class="mediuminput"></div><span style="color:red" class="errorlog">*</span></div>--><!--表单其他样式--><add key="boxdiv" value="listitem form-group"/><add key="boxChildlabel" value="listleft titles"/><add key="boxChilddiv" value="listleft con"/><!--bootstrap表单设置--><!--<add key="boxdiv" value="form-group"/><add key="boxChildlabel" value=""/><add key="boxChilddiv" value="form-control"/>-->
</appSettings>

View Code

注意:代码不是很完善  对于复选框、字体颜色还需加强构思,学识不够渊博 可能写得有点烂

适合于多表多字段需要快速开发完成的项目

转载于:https://www.cnblogs.com/lovable/p/7889971.html

webform快速创建表单内容文件--oracle 数据库相关推荐

  1. oracle创建表执行时间好长,Oracle数据库建表语句连续执行的问题

    Oracle数据库建表语句连续执行的问题 我写了一个sql文件,里面是整个库的建表语句,用oracle的dba权限用户登录.在执行每个表的建表语句的时候都是成功的,但放到一起连续执行就提示编译错误.语 ...

  2. aspx文件上传表单内容到另一个aspx文件,但后续文件无法显示出接收到的信息,大佬们该咋办

    我建立了两个aspx文件,其中一个为填写表单信息的网站,在填写完成后点击提交就会将表单信息上传到第二个asox文件中,并且在该网站的界面中显示出来.但并没有,试过了多个浏览器,代码也基本没问题.求助各 ...

  3. JavaFX官方教程(五)之在JavaFX中创建表单

    翻译自  在JavaFX中创建表单 在开发应用程序时,创建表单是一项常见活动.本教程将向您介绍屏幕布局的基础知识,如何将控件添加到布局窗格以及如何创建输入事件. 在本教程中,您将使用JavaFX构建如 ...

  4. formidable处理提交的表单或文件的简单介绍

    一般来说,客户端向服务端提交数据有GET和POST这两种方式,在之前的文章node.js当中的http模块与url模块的简单介绍当中我们可以知道通过req.url与url模块的配合处理可以快速得到客户 ...

  5. php显示html表单内容,HTML表单是什么?HTML表单内容的详细介绍(附代码)

    HTML 表单是用于搜集不同类型的用户输入的,表单是一个包含表单元素的区域:表单元素是允许用户在表单中(比如:文本域.下拉列表.单选框.复选框等等)输入信息的元素:表单使用表单标签( )定义. 一.介 ...

  6. jQuery中的ajax、jquery中ajax全局事件、load实现页面无刷新局部加载、ajax跨域请求jsonp、利用formData对象向服务端异步发送二进制数据,表单序列化(异步获取表单内容)

    jQuery中使用ajax: 在jQuery中使用ajax首先需要引入jQuery包,其引入方式可以采用网络资源,也可以下载包到项目文件中,这里推荐下载包到文件中:市面上有多个版本的jQuery库,这 ...

  7. 【原创文章】PHP+MySQL 创建表单并将表单数据写入数据库中。

    前言     因兴趣做一个静态网页需要涉及到内容存储,因此有了本文内容.本文涉及到的都是些PHP+MySQL的基础知识.仅个人做记录,文章内容未经允许禁止转载! 一.网站环境 宝塔面板,方便操作. N ...

  8. css修改layui的下拉框样式 js_layui创建表单下拉框样式不显示

    border-left: 5px solid #009688; 注释:solid实体,实心样式: Blockquote:块引用;Fieldset:字段集; 1.所有浏览器都支持 标签. fieldse ...

  9. [RFC1867] HTML中基于表单的文件上传

    网络工作组:E. Nebel 征求意见:1867 L. Masinter 类别:试验 施乐公司 十一月 1995 HTML中基于表单的文件上传 这个备忘录的状态 这个备忘录为互联网社区定义了一个试验协 ...

最新文章

  1. 从0开始搭建坚不可摧的Web系统主流架构
  2. 一文看懂深度学习模型压缩和加速
  3. java juel表达式_activiti 自定义函数解析juel表达式
  4. vscode打造golang开发环境以及golang的debug单元测试
  5. Spring ----Bean的生命周期
  6. Java 面向对象四大特性
  7. php 生成wsdl工具,php中使用zendstudio 12为soapserver生成wsdl文件
  8. php+header+跳转输出,php利用header跳转怎么失效了?
  9. 用js实现改变随意改变div属性style的名称和值的结果
  10. Jmeter中java接口测试
  11. MySQL 数据库 alter 和 update 的区别
  12. javascript-cropper插件翻译笔记
  13. 长沙县北部新城:“湖湘生态”蓝图已绘就,“右岸经济”起飞正当时
  14. WARNING:tensorflow:sample_weight modes were coerced from ... to [‘...‘]
  15. windows下用cmd卸载程序
  16. 金融民工python学习笔记
  17. False data injection attacks and the insider threat in smart systems
  18. 热搜排序 半衰期的应用
  19. ModuleNotFoundError: No module named ‘win32con‘
  20. 遥望布达拉——DAY11 海通兵站-觉巴村

热门文章

  1. saltstack自动化运维系列②之saltstack的数据系统
  2. ASP.NET自定义服务器控件
  3. 用Fiddler调试localhost
  4. 用Oracle归档日志进行恢复方法
  5. [转]Effective C#原则4:用条件属性而不是#if
  6. 未来的GDI:WPF技术纵览[zz]
  7. php分块查找,索引查找(索引查找、分块查找) C语言实现
  8. php.exe占用资源过大,记录一次php占用系统资源过高的问题
  9. geany配置python3.8_Parrot security 4.10-amd64
  10. Java并发包JUC的Lock锁讲解