I'm currently working on an "advanced" search form for my application. I'm using a datagridview
to display the results. The idea is to be able to search thoroughly (with lots of options).
Currently I fill the datagridview like this:
dgvData.AutoGenerateColumns = false;
if (cbbKlant.SelectedItem != null)
{
dgvData.DataSource = StatistiekManagement.getOpdrachten((klant)cbbKlant.SelectedItem);
//ID kolom
DataGridViewTextBoxColumn id = new DataGridViewTextBoxColumn();
id.Name = "ID";
id.DataPropertyName = "opdracht_id";
//Plaatsen kolom
DataGridViewTextBoxColumn plaatsen = new DataGridViewTextBoxColumn();
plaatsen.Name = "Plaatsen";
plaatsen.DataPropertyName = "aantal_personen";
//Vertrekplaats kolom
DataGridViewTextBoxColumn vertrek = new DataGridViewTextBoxColumn();
vertrek.Name = "Vertrek";
vertrek.DataPropertyName = "locatie_id";
this.dgvData.Columns.Add(id);
this.dgvData.Columns.Add(plaatsen);
this.dgvData.Columns.Add(vertrek);
}
My problem here is I want to add information to the datagridview
from another table. For example: I have a contract
and this contract has a location
. How do I display the location
into this datagridview
?
I also use LINQ TO SQL
to get my data from the database.
Thanks, Thomas