protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { type_2 ty2 = new type_2(); int id1 = int.Parse(DropDownList1.SelectedValue); drop2.DataSource = ty2.type_2list(id1, "").DefaultView; drop2.DataTextField = "type_2name"; drop2.DataValueField = "typeid_2"; drop2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int tid = int.Parse(Request.QueryString["tid"]); type_2 ty2 = new type_2(); Literal1.Text = ty2.gettypename(tid); product pt = new product(); DataTable db = pt.searchproductlist(0, tid, "", "", ""); ListView1.DataSource = db; ListView1.DataBind(); } }
protected void Button2_Click(object sender, EventArgs e) { type_2 tp2 = new type_2(); if (TextBox1.Text == "") { Response.Write("<script>alert('请输入二级分类名称');</script>"); return; } else { if (tp2.IsExite(TextBox1.Text)) { Response.Write("<script>alert('二级分类名称重复');</script>"); return; } else { string typeid_1 = DropDownList1.SelectedValue; string typename = TextBox1.Text; if (ViewState["op"].ToString() == "add") { tp2.createtype_2(Convert.ToInt32(typeid_1), typename); GridView1.DataBind(); weihu.Visible = false; } else if (ViewState["op"].ToString() == "edit") { tp2.updatetype_2(Convert.ToInt32(ViewState["type2id"].ToString()), Convert.ToInt32(typeid_1), typename); GridView1.DataBind(); weihu.Visible = false; } } } }