Solved

ASP.NET 2.0 / Nested Gridview / Function Question

Posted on 2006-11-22
3
464 Views
Last Modified: 2012-08-13
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
Comment
Question by:drees727
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
What are you using for a data source?  ObjectDataSource?

Bob
0
 

Author Comment

by:drees727
Comment Utility
AccessDataSource
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now