Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: RE: [aspngdata] Fill datagrid from dataset


Message #1 by =?iso-8859-1?Q?Gon=E7alo_Borr=EAga?= <goncalo.borrega@i...> on Thu, 19 Sep 2002 14:41:30 +0100
(Best explained like this)

I have 2 tables, Contact & ContactType.
Contact has a foreign key (ContactTypeID) to ContactType.

I have filled a dataset with both 2 tables and created the relation 
between them. What I would like to do is fill a datagrid (aspx) with the 
info from the join.

Ex.   Contact.ContactID    |   ContactType.Description     |   
Contact.Description

Is there any way I can do that without creating a view in the database 
or getting the join from the StoreProc? Only by using the dataset...


I would like to do something like this

<asp:TemplateColumn HeaderText=3D"Type">
  <ItemTemplate>
    <asp:Label runat=3D"server"
     Text=3D'<%# ( 
(System.Data.DataRow)(DataBinder.Eval(Container.DataItem,"ContactTypeID")
) ).GetParentRow("RelationContactType")["Description"].ToString() %>'>
    </asp:Label>
  </ItemTemplate>
</asp:TemplateColumn>

So that for each row of tables[0] (Contact) it shows 
tables[1].ContactTypeID based on relation called "RelationContactType"

Thanks

  Return to Index