protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int budgetTemplateID = GetQueryIntValue("id"); BudgetTemplateData budgetTemplateData = DB.BudgetTemplateDatas.Find(budgetTemplateID); panelTopRegion.Title = budgetTemplateData.Name; LoadData(); } }
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) { int id = GetSelectedDataKeyID(Grid1); BudgetTemplateData data = DB.BudgetTemplateDatas.Find(id); string name = data.Name; if (e.CommandName == "Delete") { // 在操作之前进行权限检查 if (data.Code == "system") { Alert.ShowInTop("不能删除默认的数据!"); } else { DB.BudgetTemplateDatas.Where(u => u.ID == id).Delete(); BindGrid(); } } }