473,224 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Best practice for combining typed DataTables for display in GridView

Hi

I need to search a number of DataTables within a DataSet (with some
relationships) and then display the filtered results in a GridView. The
Columns that need to be displayed come from 2 of the tables but the search
needs check 3 or 4 tables. Do I need to create a new DataTable which has the
columns from both the tables so I can display in the Gridview or can I get
the columns somehow from the DataSet without creating a new table?

I feel like I'm missing something when it comes to getting the benefits of
DataTable relationships in terms of combining them for display in a flat
GridView.

Any ideas suggestions, pointers to examples would be appreciated.

Thanks
Andrew
Nov 1 '07 #1
2 4102
The simple answer is make another table.

GridView gets data from a datasource. Datasource is an object. Two tables
are two objects. You have to make one single object out of columns you need
and databind to it. An obvious way is to make another DataTable, but there
could be reasons for choosing different classes.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"J055" <j0**@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi

I need to search a number of DataTables within a DataSet (with some
relationships) and then display the filtered results in a GridView. The
Columns that need to be displayed come from 2 of the tables but the search
needs check 3 or 4 tables. Do I need to create a new DataTable which has
the
columns from both the tables so I can display in the Gridview or can I get
the columns somehow from the DataSet without creating a new table?

I feel like I'm missing something when it comes to getting the benefits of
DataTable relationships in terms of combining them for display in a flat
GridView.

Any ideas suggestions, pointers to examples would be appreciated.

Thanks
Andrew


Nov 1 '07 #2
Thanks Eliyahu

That's kind of what I was coming round to thinking. If I create a DataTable
without a TableAdapter then I can populate it with the data I need from the
results search and hopefully without too much extra typing!

Thanks again
Andrew
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:u5*************@TK2MSFTNGP05.phx.gbl...
The simple answer is make another table.

GridView gets data from a datasource. Datasource is an object. Two tables
are two objects. You have to make one single object out of columns you
need
and databind to it. An obvious way is to make another DataTable, but there
could be reasons for choosing different classes.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"J055" <j0**@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Hi

I need to search a number of DataTables within a DataSet (with some
relationships) and then display the filtered results in a GridView. The
Columns that need to be displayed come from 2 of the tables but the
search
needs check 3 or 4 tables. Do I need to create a new DataTable which has
the
>columns from both the tables so I can display in the Gridview or can I
get
the columns somehow from the DataSet without creating a new table?

I feel like I'm missing something when it comes to getting the benefits
of
DataTable relationships in terms of combining them for display in a flat
GridView.

Any ideas suggestions, pointers to examples would be appreciated.

Thanks
Andrew



Nov 1 '07 #3

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

Similar topics

136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
18
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
2
by: Sarmatia | last post by:
I have a table of ID vaules that are related to lookup tables. I created a DataAccess component from wich the ObjectDataSource gets a typed datatable. A GridView is bound to that ObjectDataSource...
3
by: cbrown | last post by:
I am rebuilding an existing application that relies on an SQL DB. The app is a scheduling/employee management program. My question pertains to best practices in dotnet and database. I use a 3...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
1
by: Artificer | last post by:
I am creating an application that will have around 20 web forms. Should I create only one strongly typed dataset that includes all the DataTables required for all the forms or should I create one...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
1
by: =?Utf-8?B?U0g=?= | last post by:
To All, Just a guideline on the best practice for this issue. I have a number of tables in SQL, and I want to join across them and display their corresponding values in a datagrid. For example...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.