473,503 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Master-> Detail-> Detail with datagrids

Hello,

I am trying (unsuccessfully) to display a Master-Detail-Detail records. The
problem comes in the second detail grid. The first detail grid is
displaying correctly but it is not controlling the second grid. Here is
some code that I am using to initialize the binding:

txtName.DataBindings.Add("Text", dsFundOwner, "FundOwner.Name")
txtNote.DataBindings.Add("Text", dsFundOwner, "FundOwner.Note")
txtInformationSource.DataBindings.Add("Text", dsFundOwner,
"FundOwner.InformationSource")
txtLocation.DataBindings.Add("Text", dsFundOwner, "FundOwner.LocationState")
txtCountry.DataBindings.Add("Text", dsFundOwner, "FundOwner.Country")
txtFounder.DataBindings.Add("Text", dsFundOwner, "FundOwner.Founder")
txtTotalManaged.DataBindings.Add("Text", dsFundOwner,
"FundOwner.TotalManaged")
txtTotalManagedNotes.DataBindings.Add("Text", dsFundOwner,
"FundOwner.TotalManagedNotes")
txtRaiseNewFund.DataBindings.Add("Text", dsFundOwner,
"FundOwner.ExpectedToRaiseNewFund")
txtNewFundDate.DataBindings.Add("Text", dsFundOwner,
"FundOwner.ExpectedToRaiseNewFundDate")
dgSubsidiaries.DataSource = dsFundOwner
dgSubsidiaries.DataMember = "FundOwner.FundOwner_Subsidiary"

' This grid is not displaying correctly when the dgSubsidiaries record
pointer is changed
dgFunds.DataSource = dsFundOwner
dgFunds.DataMember = "Subsidiary.Subsidiary_Fund"

Any Suggestions?

Thanks,
Dan
Nov 20 '05 #1
1 1455
Hi,

Use Datagrid.SetDatabinding. Here is an example which uses the
northwind database.

Dim ds As DataSet

Dim daEmployees As SqlDataAdapter

Dim daOrders As SqlDataAdapter

Dim daOrderDetails As SqlDataAdapter

Dim conn As SqlConnection

Dim strConn As String

Dim strSQL As String

Dim strItem As String

Dim ctrl As Control

For Each ctrl In Me.Controls

If TypeOf ctrl Is DataGrid Then

Dim dg As DataGrid = ctrl

dg.AllowNavigation = False

End If

Next

strConn = "Server = " + Environment.MachineName + "\VSdotNet;"

strConn += "Database = NorthWind;"

strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(strConn)

ds = New DataSet

daEmployees = New SqlDataAdapter("Select * from Employees", conn)

daOrders = New SqlDataAdapter("Select * from Orders", conn)

daOrderDetails = New SqlDataAdapter("Select * from [Order Details]", conn)

daEmployees.Fill(ds, "Employee")

daOrders.Fill(ds, "Orders")

daOrderDetails.Fill(ds, "OrderDetails")

ds.Relations.Add("EmployeeOrder",
ds.Tables("Employee").Columns("EmployeeID"), _

ds.Tables("Orders").Columns("EmployeeID"))

ds.Relations.Add("Order2Details", ds.Tables("Orders").Columns("OrderID"), _

ds.Tables("OrderDetails").Columns("OrderID"))

dgEmployees.SetDataBinding(ds, "Employee")

dgOrders.SetDataBinding(ds, "Employee.EmployeeOrder")

dgOrderDetails.SetDataBinding(ds, "Employee.EmployeeOrder.Order2Details")

Ken

-------------------

"solex" <so***@nowhere.com> wrote in message
news:uu*************@TK2MSFTNGP11.phx.gbl...
Hello,

I am trying (unsuccessfully) to display a Master-Detail-Detail records. The problem comes in the second detail grid. The first detail grid is
displaying correctly but it is not controlling the second grid. Here is
some code that I am using to initialize the binding:

txtName.DataBindings.Add("Text", dsFundOwner, "FundOwner.Name")
txtNote.DataBindings.Add("Text", dsFundOwner, "FundOwner.Note")
txtInformationSource.DataBindings.Add("Text", dsFundOwner,
"FundOwner.InformationSource")
txtLocation.DataBindings.Add("Text", dsFundOwner, "FundOwner.LocationState") txtCountry.DataBindings.Add("Text", dsFundOwner, "FundOwner.Country")
txtFounder.DataBindings.Add("Text", dsFundOwner, "FundOwner.Founder")
txtTotalManaged.DataBindings.Add("Text", dsFundOwner,
"FundOwner.TotalManaged")
txtTotalManagedNotes.DataBindings.Add("Text", dsFundOwner,
"FundOwner.TotalManagedNotes")
txtRaiseNewFund.DataBindings.Add("Text", dsFundOwner,
"FundOwner.ExpectedToRaiseNewFund")
txtNewFundDate.DataBindings.Add("Text", dsFundOwner,
"FundOwner.ExpectedToRaiseNewFundDate")
dgSubsidiaries.DataSource = dsFundOwner
dgSubsidiaries.DataMember = "FundOwner.FundOwner_Subsidiary"

' This grid is not displaying correctly when the dgSubsidiaries record
pointer is changed
dgFunds.DataSource = dsFundOwner
dgFunds.DataMember = "Subsidiary.Subsidiary_Fund"

Any Suggestions?

Thanks,
Dan

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2398
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the...
4
2451
by: Steve Franks | last post by:
I have this cool nested master page scenario working great. However what is the correct way to be able to access a strongly typed property at the top level master from a content page that has a...
2
1733
by: Jon Spivey | last post by:
Hi, Using VS 2005/VB.net. I need to add a meta description tag and change a stylesheet link from a page based on a master page. Found this article...
3
6393
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
17
3134
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
2
6911
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
7
2163
by: Just Me | last post by:
Hi I have a master page with a control on it, but I need to set a property of that control from the content. my master page is called Admin.Master and the class is Admin. I have tried this
6
9118
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
5
2700
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm trying to make my code as streamlined as possible, and add CSS file references dynamically when they are required, for example, if a page contains a webcontrol, then the related CSS...
4
2945
by: harijay | last post by:
Hi I am new to writing module and object oriented python code. I am trying to understand namespaces and classes in python. I have the following test case given in three files runner , master and...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.