Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2007, 02:43 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default displaying multiple non related tables in gridv

 I am trying to display non column values from three non related tables by using object data source. Is it possible if not what is the option. Please help I am new to asp.net 2.0

 
Old September 11th, 2007, 02:59 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

What do you mean with "display non column value"? Where do they come from if they don't come from a column?

Also, it would really help if you'd explain what you need help with. Data access and object data source controls are a broad topic, so unless we know what you need to know, we can't be of much help.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 11th, 2007, 03:31 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

let me explain you, I have three tables say table1,table 2, table3,
I want to display the column value id from table1, name from table 2 and company name from table3. Can I use single object data source to display them in grid view

<asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AutoGenerateColumns="false" AllowPaging="true" GridLines="Both">
        <Columns>
            <asp:BoundField DataField="Company" HeaderText="Company" SortExpression="Company" />
            <asp:BoundField DataField="# of Notes" HeaderText="# of Notes" SortExpression="# of Notes" />
            <asp:BoundField DataField="# of Downloads" HeaderText="# of Downloads" SortExpression="# of Downloads" />
        </Columns>




    </asp:GridView>

    <asp:ObjectDataSource selectMethod="displayCust" ID="ObjectDataSource1" runat="server"></asp:ObjectDataSource> Can i user selectMethod="displayCust" for all three tables. If yes please explain, if not what is the option



 
Old September 11th, 2007, 03:39 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes you can.

In your code layer create a class that has the properties that you want to display. Then fire a SELECT statement against your database that gets the data from these three tables, possibly using a join.
In the object, copy the fields from the database (from a SqlDataReader for example) into your custom objects and return those objects to the ASPX page.
The GridView then displays the fields from the objects.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 11th, 2007, 03:54 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

not sure have faint idea can you help me out, step by step what will I do on page load, compclass, DBclass and vb class

 
Old September 11th, 2007, 04:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, actually, I can't. That's quite a lot you are asking. The way you asked your question now sounds like you are asking me to your job... ;)

You may want to read up a bit about class design, data access, object orientation and controls like the ObjectDataSource control.

Maybe this is a good start: http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416

People on this forum are more than willing to help with specific problems. However, you'll need to read and experiment a lot yourself as well.....

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old September 11th, 2007, 04:18 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have your book asp.net instant results.Can you provide me an example, where can I find similiar kind of thing, so that I can I apply it. Thanks I will appreciate your help

 
Old September 11th, 2007, 04:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The BugBase app does a lot with custom business objects. The stored procedures then access multiple tables.

Also the article I linked to should provide you with a lot of useful information.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting related tables to excel crisan Access 10 July 24th, 2012 04:23 PM
single submit to related tables forumuser BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 10 December 2nd, 2007 10:29 AM
displaying data that is related to the login user saif44 ASP.NET 2.0 Basics 0 March 9th, 2006 12:21 PM
Update Multiple Related Tables with 1 Form stephaniejones SQL Server ASP 4 July 13th, 2003 08:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.