473,700 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting 'real' table datasource from grandchild datagrid that is based on dataview

I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).

argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson. PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydata grid, dataview).table .tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid is
hitting is 'contact' ?

Thank you.
Nov 21 '05 #1
3 1616
Astro,

From a parent row you can get the childcollection of datarows.

http://msdn.microsoft.com/library/de...drowstopic.asp

In a datarow you can find in what table it is.
dr.table

That table is the complete table not the collection of the datarows which
are in the relation.

I hope this helps,

Cor

"astro" <as***@mnrr.com > schreef in bericht
news:5M******** *************@t ornado.rdc-kc.rr.com...
I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).

argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson. PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydata grid, dataview).table .tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid
is hitting is 'contact' ?

Thank you.

Nov 21 '05 #2
Hi,

"astro" <as***@mnrr.com > wrote in message
news:5M******** *************@t ornado.rdc-kc.rr.com...
I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).
Why say "real" datasource ? When you bind the DataGrid to a DataView and set
DataMember to "relation1.rela tion2" then it's still using the original
grandchild DataTable (got from da.Fill). There is a DataView inbetween used
to filter the child rows depending on the current parent row.

You can get the DataView for the visible DataTable in the DataGrid
(grandchild in this case) using the CurrencyManager :

Dim cm as CurrencyManager = DirectCast( _
BindingContext( mygrid.DataSour ce, _
mygrid.DataMemb er ), CurrencyManager )

Dim currentDataView As DataView = _
DirectCast( cm.List, DataView )

Dim currentDataTabl e As DataTable = _
currentDataView .Table
Now, currentDataTabl e is the same DataTable as the one you can get from the
DataView DataSource and the Relations.
hth,
greetings


argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson. PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydata grid, dataview).table .tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid
is hitting is 'contact' ?

Thank you.

Nov 21 '05 #3
Thanks Cor and Bart - I decided to just avoid this problem by adding the
tablename to the tag property of each datagrid on this form.

I have saved your comments and will tackle this issue on project #2.

)
"astro" <as***@mnrr.com > wrote in message
news:5M******** *************@t ornado.rdc-kc.rr.com...
I have a datagrid that is two levels down from the dataview (i.e.
grandchild). I have spent 3 hours trying to get the syntax of determining
it's real datasource (i.e. not it's source based on it's relationship with
the dataview).

argh!

company
---> person
--->contact
-contact is the 'real' datasource for the grid
-company is a dataview used to populate several text controls on the form
and is the binder that the navigation ctrls use.
-the datagrid binds to the dataview with the datamember set to
"companyPerson. PersonContact" which of course is the relationship name
between the dv and the grandchild table.

Of course - if is do the following:
mydatatable = ctype(me.mydata grid, dataview).table .tablename I get the
Company table! which is NOT what I need.

Is there a simple way of determing that the underlying table my datagrid
is hitting is 'contact' ?

Thank you.

Nov 21 '05 #4

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

Similar topics

3
1643
by: sam | last post by:
Hello group, The datagrid is sorted using a dataview. Can I get the sorted dataview or table from the datagrid or any other way. All I need to get is the sorted data. Here is my code and what I am trying to accomplish: The datagrid is sorted using: dgWIP.DataSource = dvWIP dvWIP.Sort = Me.SortColumn & " " & Me.SortOrder dgWIP.DataBind()
3
5185
by: Dan V. | last post by:
How can I use real SQL on a DataTable? i.e. not array of rows using a filter... as in DataTable.Select. I read at : microsoft.public.dotnet.framework.adonet "As others have posted: There is no SQL query processor for DataSets. You can use XPath with an XMLDataDocument built from the DataSet. You can also perform selections based on criteria, using the Find and Select methods, and you can create row filters using DataViews."
4
1552
by: - R | last post by:
Hello all. I'm new to .Net so please help me out. I have a application with several "Threads" running to observe various things. From time to time each thread need to add an log entry, which is displayed on a form (a datagrid on a form) there is no database, but i created a dataset using the designer. One Entity/Table is called Log and contains the log-entries.
5
1817
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value of the item selected by the user? That is, not the datagrid index 'location' of the item the user selected, but the value inside a column of this item the user clicked on. I would use the CurrencyManager in a windows application but I'm not...
8
2262
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in each row needs a <textarea> control. The background supporting classes are completed, the only task left now is to create the web page. I am at a loss on how to create the table in the page populated by the data. Previously, I would have just...
1
2689
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting, paginantion or accepting the add and remove item events. What i am observing is that none of the vents are happening... (Sort, page, or item). I am sure I am missing something basic here... Need help... Thanks much
4
4528
by: jaYPee | last post by:
I have 1 dataset called "dataset1" that contains 2 tables called "course" and "courseload". in my form i have a datagrid. the datasource of this datagrid is "dataset1" and the datamember is "courseload". here's the fields of every table in my dataset. "Course" table CourseID
4
1649
by: Richard Fagen | last post by:
Hi, I wondering if someone can explain the best way to show three datagrids in a parent/child/grandchild relationship? For example: Take a simple form with 3 datagrids - the top for the customers, the middle for the orders, and the bottom for the items of the order. I'd like to know the best why to update the grids so that when the user
7
1169
by: Brett Romero | last post by:
I've created a custom datagrid and would like to get only entries displaying in the grid. The datasource may be a table or dataview. So I check for this in the custom datagrid class: if (this.DataSource.GetType().FullName.Equals("System.Data.DataTable")) dt = (DataTable)this.DataSource; else if (this.DataSource.GetType().FullName.Equals("System.Data.DataView")) dt = ((DataView)this.DataSource).Table;
0
8718
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
8642
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
9066
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...
0
7802
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...
1
6558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3083
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
2
2383
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2022
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.