protected void bt_OK_Click(object sender, EventArgs e) { BBS_CatalogBLL _catalogbll = null; if (bt_OK.Text == "添加") { _catalogbll = new BBS_CatalogBLL(); } else { _catalogbll = new BBS_CatalogBLL((int)ViewState["ID"]); } UC_Catalog.GetData(_catalogbll.Model); if (bt_OK.Text == "添加") { ViewState["ID"] = _catalogbll.Add(); } else { _catalogbll.Update(); } MessageBox.ShowAndRedirect(this, "保存成功", "index.aspx"); }
private void BindData() { BBS_CatalogBLL bll = new BBS_CatalogBLL((int)ViewState["ID"]); UC_Catalog.BindData(bll.Model); bt_OK.Text = "修改"; bt_OK.ForeColor = System.Drawing.Color.Red; }