protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { string name = e.CommandName; int id = Convert.ToInt32(e.CommandArgument.ToString()); HiddenField1.Value = id.ToString(); switch (name) { case "del": category_info.Delete(id); Response.Redirect("admin.aspx?page=danhmuc"); break; case "edit": category_info ct = category_info.getbyid(id.ToString()); if (ct != null) { e_txtten.Text = ct.names; e_txtvitri.Text = ct.no.ToString(); if (ct.active) { e_CheckBox1.Checked = true; } else { e_CheckBox1.Checked = false; } } if (ct.parentid == "0") { } else { DropDownList1.DataSource = category_info.getparent("1"); DropDownList1.DataTextField = "names"; DropDownList1.DataValueField = "id"; DropDownList1.DataBind(); DropDownList1.SelectedValue = ct.parentid; } DropDownList1.Items.Add(new ListItem("--Root--", "0")); MultiView1.ActiveViewIndex = 2; break; } }
public JsonResult UpdateCategory(category_info Category) { return(Json(new { result = categoryService.UpdateCategory(Category) }, JsonRequestBehavior.AllowGet)); }