[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

ASP.NET 2.0 / Nested Gridview / Function Question

I'm using a nested gridview (idea from:  http://programmers.wordpress.com/2006/07/26/nested-gridview-to-show-masterdetails-relationship-in-aspnet-20/).  My nested gridview contains the following:

<asp:GridView ID="Gridview2" runat="server" DataSource="<%#GetNames(Convert.ToInt32(Eval("ID"))) %>"

I need to create a function that creates a datatable so each time a row is bound to the main gridview, the child gridview is also bound with the corresponding values.  I'm using Access as my database and my nested gridview select command looks something like:

SelectCommand="SELECT Table2.[Name], [Table2].[ChildID] FROM Table2 Where [Table2].[ChildID] = [Table1].[ID]

How do I use VB to create the GetNames function (below) to get this to work?  Thanks for your help!!

**********************************************************************
Public Function GetNames() As DataTable

End Function
0
drees727
Asked:
drees727
  • 2
1 Solution
 
Bob LearnedCommented:
What are you using for a data source?  ObjectDataSource?

Bob
0
 
drees727Author Commented:
AccessDataSource
0
 
Bob LearnedCommented:
1) I don't find that the AccessDataSource provides the interface members that you would need to accomplish this.

2) You could use 2 OleDbDataAdapter objects to fill a DataSet with the parent and child tables, and then add a DataRelation to the DataSet, and call DataRow.GetChildRows from the parent row to fill the nested GridView.

Bob
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now