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(); } }
private void Bind() { int pid = int.Parse(this.Request.QueryString["pid"].ToString()); DataRow row = pro.getoneproduct(pid); this.productnameliteral.Text = row["productname"].ToString(); this.IMG1.Src = "pic/" + row["imagepath"].ToString(); this.type_1nameliteral.Text = t_1.gettypename(int.Parse(row["typeid_1"].ToString())); this.type_2nameliteral.Text = t_2.gettypename(int.Parse(row["typeid_2"].ToString())); this.pointcountliteral.Text = row["pointcount"].ToString(); this.countliteral.Text = (int.Parse(row["count"].ToString()) > int.Parse(row["sellcount"].ToString())) ? row["count"].ToString() : "缺货"; this.sellcountliteral.Text = row["sellcount"].ToString(); this.priceliteral.Text = row["price"].ToString(); this.userpriceliteral.Text = row["userprice"].ToString(); this.specialsliteral.Text = row["specialsprice"].ToString(); this.descriptionliteral.Text = row["description"].ToString(); }