protected void btnLoadTeam_Click(object sender, EventArgs e) { DbTools db = new DbTools(); db.GetTeams(); GridView1.DataSource = db.Teams.Values; //GridView1.data GridView1.DataBind(); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { DbTools db = new DbTools(); db.GetTeams(); GridView table = (GridView)sender; int rowIndex = Convert.ToInt32(table.SelectedRow.Cells[0].Text); GridView2.DataSource = db.Teams[rowIndex].FirstDriver.ToDataTable(); GridView2.DataBind(); GridView3.DataSource = db.Teams[rowIndex].SecondDriver.ToDataTable(); GridView3.DataBind(); }
private void FormMain_Load(object sender, EventArgs e) { db = new DbTools(); db.GetTeams(); //teams = new BindingList<Team>(db.Teams); listBoxTeam.DataSource = teams; cmbCountry.DataSource = new BindingSource(db.Countries, null); cmbCountry.DisplayMember = "Value"; cmbCountry.ValueMember = "Key"; cmbFirstDriver.DataSource = new BindingSource(db.Drivers, null); cmbFirstDriver.DisplayMember = "Value"; cmbFirstDriver.ValueMember = "Key"; cmbSecondDriver.DataSource = new BindingSource(db.Drivers, null); cmbSecondDriver.DisplayMember = "Value"; cmbSecondDriver.ValueMember = "Key"; }
public IEnumerable <Team> GetAllTeams() { db.GetTeams(); return(db.Teams.Values); }