protected void Page_Load(object sender, EventArgs e) { db = new Database(); db.Init_database(); this.GridView1.DataSource = db.get_DataSet("ManagerList"); this.GridView1.DataBind(); this.GridView3.DataSource = db.get_DataSet("UserList"); this.GridView3.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { db = new Database(); db.Init_database(); DataTable mytable = db.get_Table("HomePage"); if (!this.IsPostBack) { this.GridView1.DataSource = db.get_DataSet("HomePage"); this.GridView1.DataBind(); } for (int i = 0; i < GridView1.Rows.Count; i++) { TableCell cell = new TableCell(); LinkButton link = new LinkButton(); link.ID = GridView1.Rows[i].Cells[1].Text + "change"; link.Text = "编辑"; link.Click += new EventHandler(Button2_Click); Label lb = new Label(); lb.Text = " "; LinkButton link2 = new LinkButton(); link2.Text = "删除"; link2.ID = GridView1.Rows[i].Cells[1].Text + "del"; link2.Click += new EventHandler(Button3_Click); cell.Controls.Add(link); cell.Controls.Add(lb); cell.Controls.Add(link2); GridView1.Rows[i].Cells.Add(cell); } }
protected void Page_Load(object sender, EventArgs e) { db = new Database(); db.Init_database(); if (!this.IsPostBack) { this.GridView1.DataSource = db.get_DataSet("VegetableList"); this.GridView1.DataBind(); this.GridView2.DataSource = db.get_DataSet("MeatList"); this.GridView2.DataBind(); this.GridView3.DataSource = db.get_DataSet("FisheryList"); this.GridView3.DataBind(); this.GridView4.DataSource = db.get_DataSet("CondimentList"); this.GridView4.DataBind(); this.GridView5.DataSource = db.get_DataSet("FruitList"); this.GridView5.DataBind(); } this.GridView1.ID = "VegetableList"; this.GridView2.ID = "MeatList"; this.GridView3.ID = "FisheryList"; this.GridView4.ID = "CondimentList"; this.GridView5.ID = "FruitList"; set(GridView1); set(GridView2); set(GridView3); set(GridView4); set(GridView5); }