protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <SheBeiType> list1 = TypeManger.select(); foreach (SheBeiType sb1 in list1) { ListItem li1 = new ListItem(); li1.Value = sb1.TypeId.ToString(); li1.Text = sb1.Typename; this.DropDownList1.Items.Add(li1); } this.DropDownList1.Items.Insert(0, "----请选择类型----"); } this.Repeater1.DataSource = ShebeiManger.select(); this.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { Serice sc = new Serice(); sc.Name = Request["name"].ToString(); List <shebei> list = ShebeiManger.select(sc.Name); foreach (shebei item in list) { sc.shebeiID = item.ID; } if (Request["type"].ToString() == "常用类") { sc.DeviceType = 1; } if (Request["type"].ToString() == "普通类") { sc.DeviceType = 2; } if (Request["type"].ToString() == "其他类") { sc.DeviceType = 3; } sc.Area = Request["area"].ToString(); sc.Weixiuer = this.TextBox1.Text; sc.Guzhang = this.TextBox2.Text; sc.WeixiuData = this.TextBox3.Text; sc.Money = this.TextBox4.Text; sc.UseTime = this.TextBox5.Text; sc.Beizu = this.TextBox6.Text; sc.Url = "Images/"; if (SericeManger.add(sc)) { ClientScript.RegisterStartupScript(this.GetType(), "loginSucess", "<script>alert('提交成功! ')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <shebei> list = ShebeiManger.select(); foreach (shebei sb in list) { ListItem li = new ListItem(); li.Value = sb.ID.ToString(); li.Text = sb.Name; this.DropDownList1.Items.Add(li); } List <SheBeiType> list1 = TypeManger.select(); foreach (SheBeiType sb1 in list1) { ListItem li1 = new ListItem(); li1.Value = sb1.TypeId.ToString(); li1.Text = sb1.Typename; this.DropDownList2.Items.Add(li1); } } }