protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "") { int sid = Convert.ToInt32(Request.QueryString["sid"].ToString()); model = bll.GetModel(sid); txtMuneName.Text = model.SName; txtUrlAdd.Text = model.Surl; txtOrder.Text = model.Sorder.ToString(); DropDownList1.SelectedValue = model.Starget; } if (Request.UrlReferrer != null) { ViewState["returnUrl"] = Request.UrlReferrer.ToString(); } else { ViewState["returnUrl"] = "MenuList1.aspx"; } if (Request.QueryString["ji"] != null && Request.QueryString["ji"] != "") { switch (Request.QueryString["ji"].ToString()) { case "1": lbmenu.Text = "修改一级菜单"; break; case "2": lbmenu.Text = "修改二级菜单"; break; case "3": lbmenu.Text = "修改三级菜单"; break; case "4": lbmenu.Text = "修改四级菜单"; break; default: break; } } else { lbmenu.Text = "修改一级菜单"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.UrlReferrer != null) { ViewState["url"] = Request.UrlReferrer.ToString(); } else { ViewState["url"] = "MenuList1.aspx"; } if (Request.QueryString["sid"] != "" && Request.QueryString["sid"] != null) { int sid = Convert.ToInt32(Request.QueryString["sid"].ToString()); model = bll.GetModel(sid); if (model.SCheck == 1) { model.SCheck = 0; } else { model.SCheck = 1; } bll.Update(model); Response.Redirect(ViewState["url"].ToString()); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int sid = int.Parse(e.CommandArgument.ToString()); int check = 0; switch (e.CommandName) //壮态 { case "check": model = bll.GetModel(sid); if (model.SCheck == 0) { check = 1; } else { check = 0; } model.SCheck = check; bll.Update(model); databind(ViewState["order"].ToString()); break; case "xiaji": //添加一下级菜单 Response.Redirect("MenuList2.aspx?sid=" + sid); break; case "modefiy": //修改 Response.Redirect("ModefiyMenu.aspx?sid=" + sid + "&ji=1"); break; case "Del": //删除 bll.Delete(sid); databind(ViewState["order"].ToString()); break; default: break; } }