Hi,

I'm trying to bind a datarelation to a datagrid so that I'll show all the
columns from the first and second datatables that relate (parent/child).

The code below only shows the data from the master table? How do I include
the children? I'm having trouble find docs on this.

dst.Relations.Add("ArticleCompany", dst.Tables["Article"].Columns["CoId"],
dst.Tables["Company"].Columns["CoId"],false);

DataGrid1.DataSource = dst.Tables["Article"].DefaultView;
DataGrid1.DataMember = "ArticleCompany";
DataGrid1.DataBind();

Re: Binding a DataRelation to a Datagrid?? by Val

Val
Tue Apr 05 19:11:25 CDT 2005

Hi,

Check next KB with an example

http://support.microsoft.com/default.aspx?scid=kb;en-us;308052

--
Val Mazur
Microsoft MVP

http://xport.mvps.org



"Dave" <Dave@discussions.microsoft.com> wrote in message
news:630E64D5-75E3-48D0-A522-7481D2F14BC3@microsoft.com...
> Hi,
>
> I'm trying to bind a datarelation to a datagrid so that I'll show all the
> columns from the first and second datatables that relate (parent/child).
>
> The code below only shows the data from the master table? How do I include
> the children? I'm having trouble find docs on this.
>
> dst.Relations.Add("ArticleCompany", dst.Tables["Article"].Columns["CoId"],
> dst.Tables["Company"].Columns["CoId"],false);
>
> DataGrid1.DataSource = dst.Tables["Article"].DefaultView;
> DataGrid1.DataMember = "ArticleCompany";
> DataGrid1.DataBind();