yanci1179
asked on
data binding/navigation
I am using .net 2.0, have four comboboxes and 1 datagridview.
ComboBox1--hold values of a method
ComboBox2--holds values of a abbreviation it's the ID of the method
ComboBox3--Description
ComboBox4--Location
datagridview--phonenumbers email, basically contact info
All of the comboboxes are initially filled with values from look table. What I would like to do is if the user where
to pick let's say location = '4521 never land' then combobox1,combobox2, and the datagrid would
show information that is relevant to that location. Basically skip to that record. Same for the other comboboxes, if combobox1 is changed that show relevant record,
Currently, the form opens up is is binded with a datasource that has all to fields. You can navigate on at a time.
Any suggestions of how I can go about this or where I can find a good example?
Thanks.
Yanci.
ComboBox1--hold values of a method
ComboBox2--holds values of a abbreviation it's the ID of the method
ComboBox3--Description
ComboBox4--Location
datagridview--phonenumbers
All of the comboboxes are initially filled with values from look table. What I would like to do is if the user where
to pick let's say location = '4521 never land' then combobox1,combobox2, and the datagrid would
show information that is relevant to that location. Basically skip to that record. Same for the other comboboxes, if combobox1 is changed that show relevant record,
Currently, the form opens up is is binded with a datasource that has all to fields. You can navigate on at a time.
Any suggestions of how I can go about this or where I can find a good example?
Thanks.
Yanci.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
the values of the comboboxes are coming from a look up table so don't they have to have a different datasource?
here's what I'm doing:
Ds = new DataSet()
Cmd = new SqlCommand(SProc, CohortConn);
Cmd.CommandType = CommandType.StoredProcedur
Da = new SqlDataAdapter(Cmd);
Da.Fill(Ds, "tblMtdDesc");
BindSrceMtd.DataSource = DsMtd;
BindSrceMtd.DataMember = "tblMtdDesc";
//Above, this datasource is the one that I'm using as the main source for all of my controls. It contains all of the methods entered.
//below: this is where I am getting the datasource from the look up tables for the comboboxes
DsMtd = new DataSet()
CmdMtd = new SqlCommand(SProcMtd, CohortConn);
CmdMtd.CommandType = CommandType.StoredProcedur
DaMtd = new SqlDataAdapter(CmdMtd);
DaMtd.Fill(DsMtd, "tblMtdAbb");
DsDec = new DataSet()
CmdDec = new SqlCommand(SProcDec, CohortConn);
CmdDec.CommandType = CommandType.StoredProcedur
DaDec = new SqlDataAdapter(CmdDec);
DaDec.Fill(DsMtd, "tblDec");
BindSrceLkUp.DataSource = DsMtd;
//below this is the the way that I'm binding the combobox that has the ID of every method used
CbMtd.DataSource = BindSrceLkUp;
CbMtd.DisplayMember = "tblMtd.Name_Lk",
CbMtd.ValueMember = "tblMtd.ID_Lk";
CbMtd.DataBindings.Add("Se
//this is how I'm binding the combobox that has the description of each method (all should be unique)
CbDec.DataSource = BindSrceLkUp;
CbDec.DisplayMember = "tblDec.Name_Lk",
CbDec.ValueMember = "tblDec.ID_Lk";
CbDec.DataBindings.Add("Se
At this time, the controls are not synchronized. When I change out combobox it does not change the other controls. What am I doing wrong?
Thanks for the help!!
Yanci.
ASKER
okay, so I got it. I joined the look up table within my stored procedure that way everything could be in one datasource. Thanks!!
Heidi.
Heidi.
What are your tables and their columns?
heidar