//----------------------------------------------- // 页面事件 //----------------------------------------------- // 初始化 public void InitForm() { if (string.IsNullOrEmpty(EntityTypeName)) { return; } this.entityType = Assembly.GetExecutingAssembly().GetType(EntityTypeName); // 构建表单 InitToolbar(); InitItemID(); this.map = FormHelper.BuildForm(this, new UISetting(this.entityType), false, this.Mode == PageMode.View); if (this.Mode == PageMode.View) { this.btnSaveClose.Visible = false; this.btnSaveNew.Visible = false; FormHelper.SetFormEditable(this, false); } // 初始化 if (!(HttpContext.Current.Handler as Page).IsPostBack) { this.lblId.Text = this.EntityID.ToString(); this.btnSaveNew.Visible = (this.EntityID == -1); if (this.EntityID != -1) { ShowData(this.EntityID); } } }
//----------------------------------------------- // 显示表单数据 //----------------------------------------------- /// <summary>绑定表单。自动生成表单控件,并显示数据</summary> /// <param name="form">表单对象</param> /// <param name="o">数据对象</param> public static void BindForm(FormBase form, object o) { var map = FormHelper.BuildForm(form, new UISetting(o.GetType())); ShowFormData(map, o); }