Hi, I have 2 tables and I have created a datarelation for them. my problem is the primary key column on the parent table needs to be binded in a textbox so that when that textbox changes, the gridview containing all the child table data would be updated. First I don't know how to bind the data in a textbox inside an ASP.Net page and also doesn't know how to bind the child table on the gridview.
table1:
ClientId - Pk
clientname
clientstatus
table2:
PersonId - Pk
ClientId - Fk
PersonName
* Datarelation declaration
_theCmd = new SqlCommand("Select * from Contacts", conn);
_theCmd.CommandType = CommandType.Text;
_theDA = new SqlDataAdapter(_theCmd);
_theDS = new DataSet();
_theDA.Fill(_theDS,"Contacts");
_theCmd = new SqlCommand("Select * from ClientContactInfo", conn);
_theCmd.CommandType = CommandType.Text;
_theDA.Fill(_theDS, "CPersonInfo");
DataRelation ContactCP = new DataRelation("ContactCP", _theDS.Tables["Contacts"].Columns["ClientID"], _theDS.Tables["CPersonInfo"].Columns["ClientId"]);
_theDS.Relations.Add(ContactCP);
* process on asp.net page
there is a search button to search for the clientname. when the client name is found. a textbox.text
will be replaced by the clientid. when the textbox.text changes the value of the datagrid should
also change relating to the clientid.