Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 11th, 2007, 03:43 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old September 11th, 2007, 03:59 PM
Imar's Avatar
Wrox Author
Points: 67,581, Level: 100
Points: 67,581, Level: 100 Points: 67,581, Level: 100 Points: 67,581, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,269
Thanks: 66
Thanked 1,428 Times in 1,408 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
Reply With Quote
  #3 (permalink)  
Old September 11th, 2007, 04:31 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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



Reply With Quote
  #4 (permalink)  
Old September 11th, 2007, 04:39 PM
Imar's Avatar
Wrox Author
Points: 67,581, Level: 100
Points: 67,581, Level: 100 Points: 67,581, Level: 100 Points: 67,581, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,269
Thanks: 66
Thanked 1,428 Times in 1,408 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
Reply With Quote
  #5 (permalink)  
Old September 11th, 2007, 04:54 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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

Reply With Quote
  #6 (permalink)  
Old September 11th, 2007, 05:07 PM
Imar's Avatar
Wrox Author
Points: 67,581, Level: 100
Points: 67,581, Level: 100 Points: 67,581, Level: 100 Points: 67,581, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,269
Thanks: 66
Thanked 1,428 Times in 1,408 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
Reply With Quote
  #7 (permalink)  
Old September 11th, 2007, 05:18 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
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

Reply With Quote
  #8 (permalink)  
Old September 11th, 2007, 05:21 PM
Imar's Avatar
Wrox Author
Points: 67,581, Level: 100
Points: 67,581, Level: 100 Points: 67,581, Level: 100 Points: 67,581, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,269
Thanks: 66
Thanked 1,428 Times in 1,408 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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting related tables to excel crisan Access 10 July 24th, 2012 05: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 09:52 PM



All times are GMT -4. The time now is 01:32 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.