Solved

ASP.NET 2.0 / Nested Gridview / Function Question

Posted on 2006-11-22
3
473 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
ID: 17998673
What are you using for a data source?  ObjectDataSource?

Bob
0
 

Author Comment

by:drees727
ID: 17998688
AccessDataSource
0
 
LVL 96

Accepted Solution

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on Add method 1 51
Run time Error 4 48
How to close an asp.net web form using C# ? 4 30
How come this regular expression allows "e"? 14 38
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 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