/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(Object sender, EventArgs e) { //HtmlDocument _xml = new HtmlDocument(); //_xml.LoadHtml(Content.Text); //HtmlNode form = _xml.DocumentNode.SelectSingleNode("//form"); //if (form == null) //{ // Alert(Label1, "没有发现表单!", "line1px_2"); // return; //} //HtmlAttributeCollection att = form.Attributes; //if (att["name"] == null || String.IsNullOrEmpty(att["name"].Value)) //{ // Alert(Label1, "表单名字未设置!", "line1px_2"); // return; //} //String name = att["name"].Value; if (IsEdit) { CurrentForm = CurrentForms.Find(a => { return(a.ID == EditID); }); } else { CurrentForm = new TableFormItem { ID = Guid.NewGuid() }; CurrentForms.Add(CurrentForm); } this.GetFormValue <TableFormItem>(CurrentForm); TableForm.SaveForms(); Alert(Label1, "保存成功!", "line1px_3"); }
/// <summary> /// 列表事件 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "del") { Guid id = Guid.Parse(((HtmlInputCheckBox)e.Item.FindControl("id")).Value); TableFormItem frm = CurrentForms.Find(a => { return(a.ID == id); }); if (id != null) { CurrentForms.Remove(frm); TableForm.SaveForms(); } this.BindData(); } }
/// <summary> /// 加载编辑数据 /// </summary> protected void LoadData() { CurrentForm = CurrentForms.Find(a => { return(a.ID == EditID); }); this.SetFormValue(CurrentForm); }