Example #1
0
 protected void grvbookcategorylist_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "editcategory")
     {
         #region 编辑
         Panel1.Visible       = true;
         ViewState["operate"] = "edit";
         Categories category = CategoriesManager.GetCategoriesById(Convert.ToInt32(e.CommandArgument));
         txtbookcategory.Text = category.Name;
         #endregion
     }
     if (e.CommandName == "deletecategory")
     {
         #region  除
         ViewState["CategoryId"] = e.CommandArgument;
         if (CategoriesManager.FindCategoryIsBook(Convert.ToInt32(ViewState["CategoryId"])))
         {
             CategoriesManager.DeleteCategoryById(Convert.ToInt32(ViewState["CategoryId"]));
         }
         else
         {
             mydiv.Visible = true;
         }
         BindData();
         #endregion
     }
 }