473,769 Members | 7,756 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.DataBin dings.Add("Text ", dsFundOwner, "FundOwner.Name ")
txtNote.DataBin dings.Add("Text ", dsFundOwner, "FundOwner.Note ")
txtInformationS ource.DataBindi ngs.Add("Text", dsFundOwner,
"FundOwner.Info rmationSource")
txtLocation.Dat aBindings.Add(" Text", dsFundOwner, "FundOwner.Loca tionState")
txtCountry.Data Bindings.Add("T ext", dsFundOwner, "FundOwner.Coun try")
txtFounder.Data Bindings.Add("T ext", dsFundOwner, "FundOwner.Foun der")
txtTotalManaged .DataBindings.A dd("Text", dsFundOwner,
"FundOwner.Tota lManaged")
txtTotalManaged Notes.DataBindi ngs.Add("Text", dsFundOwner,
"FundOwner.Tota lManagedNotes")
txtRaiseNewFund .DataBindings.A dd("Text", dsFundOwner,
"FundOwner.Expe ctedToRaiseNewF und")
txtNewFundDate. DataBindings.Ad d("Text", dsFundOwner,
"FundOwner.Expe ctedToRaiseNewF undDate")
dgSubsidiaries. DataSource = dsFundOwner
dgSubsidiaries. DataMember = "FundOwner.Fund Owner_Subsidiar y"

' This grid is not displaying correctly when the dgSubsidiaries record
pointer is changed
dgFunds.DataSou rce = dsFundOwner
dgFunds.DataMem ber = "Subsidiary.Sub sidiary_Fund"

Any Suggestions?

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

Use Datagrid.SetDat abinding. 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.AllowNavigat ion = False

End If

Next

strConn = "Server = " + Environment.Mac hineName + "\VSdotNet; "

strConn += "Database = NorthWind;"

strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(s trConn)

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.Fil l(ds, "Employee")

daOrders.Fill(d s, "Orders")

daOrderDetails. Fill(ds, "OrderDetai ls")

ds.Relations.Ad d("EmployeeOrde r",
ds.Tables("Empl oyee").Columns( "EmployeeID "), _

ds.Tables("Orde rs").Columns("E mployeeID"))

ds.Relations.Ad d("Order2Detail s", ds.Tables("Orde rs").Columns("O rderID"), _

ds.Tables("Orde rDetails").Colu mns("OrderID"))

dgEmployees.Set DataBinding(ds, "Employee")

dgOrders.SetDat aBinding(ds, "Employee.Emplo yeeOrder")

dgOrderDetails. SetDataBinding( ds, "Employee.Emplo yeeOrder.Order2 Details")

Ken

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

"solex" <so***@nowhere. com> wrote in message
news:uu******** *****@TK2MSFTNG P11.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.DataBin dings.Add("Text ", dsFundOwner, "FundOwner.Name ")
txtNote.DataBin dings.Add("Text ", dsFundOwner, "FundOwner.Note ")
txtInformationS ource.DataBindi ngs.Add("Text", dsFundOwner,
"FundOwner.Info rmationSource")
txtLocation.Dat aBindings.Add(" Text", dsFundOwner, "FundOwner.Loca tionState") txtCountry.Data Bindings.Add("T ext", dsFundOwner, "FundOwner.Coun try")
txtFounder.Data Bindings.Add("T ext", dsFundOwner, "FundOwner.Foun der")
txtTotalManaged .DataBindings.A dd("Text", dsFundOwner,
"FundOwner.Tota lManaged")
txtTotalManaged Notes.DataBindi ngs.Add("Text", dsFundOwner,
"FundOwner.Tota lManagedNotes")
txtRaiseNewFund .DataBindings.A dd("Text", dsFundOwner,
"FundOwner.Expe ctedToRaiseNewF und")
txtNewFundDate. DataBindings.Ad d("Text", dsFundOwner,
"FundOwner.Expe ctedToRaiseNewF undDate")
dgSubsidiaries. DataSource = dsFundOwner
dgSubsidiaries. DataMember = "FundOwner.Fund Owner_Subsidiar y"

' This grid is not displaying correctly when the dgSubsidiaries record
pointer is changed
dgFunds.DataSou rce = dsFundOwner
dgFunds.DataMem ber = "Subsidiary.Sub sidiary_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
2438
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 web part page? Does it take place at the page level? ...or the content area level? 3. Where is the Web Part Manager instantiated? ...in the Master Page? ....Content Page? ...elsewhere?
4
2469
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 nested master page between the content page and the top level master? For example, assume the very top level master is called CompanyWide.master. And the nested master page is called DepartmentA.master, which inherits from CompanyWide master. ...
2
1756
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 http://msdn.microsoft.com/asp.net/reference/design/default.aspx?pull=/library/en-us/dnvs05/html/masterpages.asp#masterpages_topic8 Which seems to suggest it's possible (Listing 11 half way down the page) but the method for adding a meta tag Master.Page.Header.Metadata.Add("Description",...
3
6441
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 BarLabelText. I now have a contentpage "FooBar.aspx", where "Bar.master" is the master page and in the content section has the control "Foo.ascx".
17
3160
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 pages? Kinda sorta a critical point no? Am I missing something? Rob. P.S. the day I find a book that actually is useful rather than just a
2
7026
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 header. I tried to put the link tag in the Master page, but the classes are not recognized in the Content Page. How do I use a StyleSheet with the Content Page? TIA
7
2185
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
9159
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" %> On the Master Page I have a public property exposed: Public Property ErrorMessage() As String Get Return txtError.InnerText End Get
5
2715
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 file is added by the webcontrol. This prevents me having to remember to add the CSS file to the page if I use a certain webcontrol. I have a MasterPage with an array of StyleSheets, and a public function for
4
2965
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 child. I am getting an error within child where in one line it understands variable master.name and in the next line it gives a NameError as given here " print "Reset name now from %s to %s , oldname %s is saved in mastertrash" %...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9414
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9977
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9848
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8860
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3947
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 we have to send another system
3
2810
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.