Example #1
0
 protected void btnok_Click(object sender, EventArgs e)
 {
     if (ViewState["operate"].ToString() == "edit")
     {
         #region 更新
         Categories category = CategoriesManager.GetCategoriesById(Convert.ToInt32(ViewState["categoryId"]));
         category.Name = txtbookcategory.Text.Trim();
         CategoriesManager.UpdateCategory(category);
         Panel1.Visible = false;
         BindData();
         #endregion
     }
     else
     {
         #region 添加
         CategoriesManager.AddCategory(txtbookcategory.Text);
         Panel1.Visible = false;
         BindData();
         #endregion
     }
 }