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() { DataTable t_1table = t_1.type_1list(""); this.parent.DataSource = t_1table.DefaultView; this.parent.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(); } }