protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text != "") { type_1 tp1 = new type_1(); string typename = TextBox1.Text; if (tp1.IsExite(typename)) { Response.Write("<script>alert('该一级分类名称已存在');</script>"); return; } else { int i = tp1.createtype_1(typename); if (i > 0) { GridView1.DataBind(); Response.Write("<script>alert('创建一级分类成功');</script>"); } } } else { Response.Write("<script>alert('请输入一级分类名称');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { product pro = new product(); type_1 ty1 = new type_1(); type_2 ty2 = new type_2(); int id = int.Parse(Request.QueryString["pid"]); DataRow dr = pro.getoneproduct(id); TextBox1.Text = dr["productname"].ToString(); DropDownList1.Items.Add(new ListItem(ty1.gettypename((int)dr["typeid_1"]), dr["typeid_1"].ToString())); DataTable table = ty1.type_1list(""); foreach (DataRow row in table.Rows) { DropDownList1.Items.Add(new ListItem(row["typename"].ToString(), row["typeid_1"].ToString())); } drop2.Items.Add(new ListItem(ty2.gettypename((int)dr["typeid_2"]), dr["typeid_2"].ToString())); CheckBox1.Checked = (bool)dr["recommended"]; CheckBox2.Checked = (bool)dr["specials"]; TextBox2.Text = dr["price"].ToString(); TextBox3.Text = dr["userprice"].ToString(); TextBox4.Text = dr["specialsprice"].ToString(); TextBox5.Text = dr["pointcount"].ToString(); Image1.ImageUrl = "../pic/" + dr["imagepath"].ToString(); TextBox6.Text = dr["count"].ToString(); TextBox7.Text = dr["sellcount"].ToString(); TextBox8.Text = dr["description"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { type_1 tp1 = new type_1(); DropDownList1.DataSource = tp1.getall(); DropDownList1.DataTextField = "typename"; DropDownList1.DataValueField = "typeid_1"; DropDownList1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { type_1 ty1 = new type_1(); DropDownList1.DataSource = ty1.type_1list("").DefaultView; DropDownList1.DataTextField = "typename"; DropDownList1.DataValueField = "typeid_1"; DropDownList1.DataBind(); } }