Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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
 
 
Thread Tools Search this Thread Display Modes
  #31 (permalink)  
Old November 14th, 2007, 09:49 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks. i downloaded your files and working with them now. looks like there's still quite a bit of work to do to produce, for example, an index [gridview] of employees which includes *some* fields from the employees table and *some* fields from the departments table [i mentioned these in a post above]. but many thanks in any case.
  #32 (permalink)  
Old November 14th, 2007, 10:03 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - alas, the holy grail of pressing a button and the application being notionally generated is still quite some way off :). what we're working with here (with that last set of templates/dll) is the idea that by creating indexes where foreign keys exist and creating secondary indexes on tables where they are related to a primary key (i.e. posts->forum on fourmID), we are then able to leverage out all parent/child collections (as well as referencing the parent object from the child object). there will still be manual effort required to functionally 'present' combinations of data the exist thro' those relationships. hopefully, the generated classes will give you the foundation to do this and you'll only need to do any tweaking in your UI layer.

let me know if i've misread the situation here.

jimi

http://www.originaltalent.com
  #33 (permalink)  
Old November 14th, 2007, 10:09 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

no, i think you're read it correctly. i created the indexes on the fk's and the generator does it's stuff. but i'm still not clear on how to bind an objectdatasource [which i want to use to populate a gridview with an index of employees] to an object which doesn't exist. viz: an object which represents fields from both tables. like i said, i'm a newbie at this and prob missing something in the greater scheme of things.

  #34 (permalink)  
Old November 14th, 2007, 01:26 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Quote:
quote:Originally posted by forumuser
 no, i think you're read it correctly. i created the indexes on the fk's and the generator does it's stuff. but i'm still not clear on how to bind an objectdatasource [which i want to use to populate a gridview with an index of employees] to an object which doesn't exist. viz: an object which represents fields from both tables. like i said, i'm a newbie at this and prob missing something in the greater scheme of things.
i still think you may have your design concept 'wrong' (i'll explain). if you're going for a master/detail relationship, you'll almost certainly always have a one to many relationship occurring. therefore, in your gridview, you are not going to be able to show this relationship on a single row. i think it might be helpful if you could drop off an example of exactly what you hope to achieve both visually and functionally (i.e. updates/inserts/deletes etc).

i could be wrong but my gut feel is that you're looking for a solution to a problem that in itself is a problem ...

[edit] an example of the child collections within a single aspx UI can be found in the ShowArticle.aspx page, where you have a objectdatasource, for the comments (objComments) and in the code-behind, an Article object set to the querysting to get the article (Article article = Article.GetArticleByID(_articleID);). i think you may need to explore these mixed concepts to get an idea of how to achieve your goal perhaps. you could also logically populate the comments from the Article article object in the code-behind using the article.Comments property


jimi

http://www.originaltalent.com
  #35 (permalink)  
Old November 14th, 2007, 01:37 PM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi jimi, thanks for your reply and i really appreciate your help with this.

i have a fairly large application, which has lots of one-to-many and many-to-many relationships in various places. there are approaching 80 forms, many of which are quite complex and each of which submits data back to many tables.
anyway, before commiting to the tbh architecture i need to see how various things are done. one common scenario is the 'index'. this is simply a view of existing data presented in a gridview. usually, one row will come from several tables, all related. the example i gave was the employees and departments table. each employee belongs to a particular department. departments are in a lookup table and so in the emplyee table i have the DepartmentID field which is a fk to the DepartmentID field in the departments lookup table. however, in the gridview, i want to see the name of the department, not just it's ID. so:

Departments table looks like:

DepartmentID int
DepartmentName nvarchar(100)


Employee table looks like:

EmployeeID int
EmployeeFirstName nvarchar(50)
EmployeeLastName nvarchar(50)
DepartmentID int
etc.....

the gridview will display:

FName LName Department
John Smith Finance

etc

is this easy to do?

  #36 (permalink)  
Old November 14th, 2007, 01:40 PM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi, i see your edit. yes, i noticed that while reading through the orders stuff earlier. i'll have a look at it this evening. it might be a way forward.
many thanks again....

  #37 (permalink)  
Old November 14th, 2007, 01:44 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - yes, you need to break away a little from the objectdatasourse approach and look at using the objects in the code behind. this is by far the most 'programmer' friendly way to work. this way you create placeholders on the aspx page and then in the Page_Load event, get the object from the querystring and then populate the placeholders.

so, in your example above, you'd get the department object for the deptid found in the employee object (you may already have this object embeded inside the employee object anyway) and set the values onto the placeholders in the Page_Load as refered to above. use the ShowArticle.aspx.cs code to get into the concepts of this.

jimi

http://www.originaltalent.com
  #38 (permalink)  
Old November 14th, 2007, 01:48 PM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

cheers. i'll have a look at that after dinner. keeps me off my new strat and mesa lonestar!

  #39 (permalink)  
Old November 14th, 2007, 02:43 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

forumuser - ahh, a fellow player. you can check out some of the stuff i do with an acoustic (indie) band here:

http://www.myspace.com/killinfolk

also, i play with a funk/rock band doing 70's style stuff - good fun... my last purchase was a nice telecaster deluxe which i replaced the pups with the bareknuckle ones:

http://www.bareknucklepickups.co.uk/

happy 'playing' whichever form it takes...


jimi

http://www.originaltalent.com
  #40 (permalink)  
Old November 15th, 2007, 05:27 AM
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

cool. here's me on acoustic [after a bottle of wine]....

http://www.podsol.co.uk/mp3/midnighttrain2.mp3

back on topic. this architecture doesn't seem too intuitive to me, even for such a simple situation as the one i outlined earlier. perhaps i should stick with my current method of datasets. we'll see...
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
THB old Template... it´s time for a new look kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 October 5th, 2007 05:42 PM



All times are GMT -4. The time now is 08:20 AM.


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