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
  #1 (permalink)  
Old May 28th, 2007, 06:51 PM
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameters automatically inferred?

In chapter 5, on page 244, it says:

"There's a second ObjectDataSource used to handle the data retrieval, inserts, and updates from the bottom DetailsView. All parameters for the insert and update are automatically inferred from the DetailsView's fields."

How is this possible? Is it because the params for the actual "UpdateCategory" and "InsertCategory" methods in the Category class are spelled the same way as the string params for the "Bind" and "Eval" methods (managecategories.aspx)?

If so, then this "matching" process is case-insensitive, correct?

  #2 (permalink)  
Old May 29th, 2007, 06:35 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello,

excuse me for my english i speak like tarzan ;) i prefer french but it's not problem ok.

not forget that ObjectDataSource behave like bridge and when you bind your detailsview to your ObjectDataSource the detailsview create a datafield for each property that is returned by your select method for you (In this case the Category object) which you can convert to TemplateField if you want to personalize appearance or add validator this involve creation of eval and bind method for each property for you.
when you update data from detailsview for example, the ObjectDataSource take all properties modified from detailsview control and pass them to the UpdateCategory method for update.

i hope that's can help you.

cheers.


  #3 (permalink)  
Old May 29th, 2007, 12:05 PM
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mesdouri

not forget that ObjectDataSource behave like bridge and when you bind your detailsview to your ObjectDataSource the detailsview create a datafield for each property that is returned by your select method for you (In this case the Category object) which you can convert to TemplateField if you want to personalize appearance or add validator this involve creation of eval and bind method for each property for you.
when you update data from detailsview for example, the ObjectDataSource take all properties modified from detailsview control and pass them to the UpdateCategory method for update.
Hello, thanks for your response...but this does not really help me much. I know that all this works. I'm only wondering how it works. I will be more specific. For example, that ObjectDataSource's chosen insert method looks like this:

public static int InsertCategory(string title, int importance, string description, string imageUrl)

If ASP.NET passes values from the input TextBoxes to that method, how does ASP.NET automatically know exactly which input value must go to which parameter, in the above method? What will happen if I change the order or spelling of the parameters in the above method?
  #4 (permalink)  
Old May 29th, 2007, 01:25 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello;

i think this link will help you .

http://www.asp.net/learn/dataaccess/....aspx?tabid=63

cheers

  #5 (permalink)  
Old May 30th, 2007, 01:50 AM
Authorized User
 
Join Date: Jan 2007
Location: , , .
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mesdouri
 hello;

i think this link will help you .

http://www.asp.net/learn/dataaccess/....aspx?tabid=63

cheers

Thanks for the link. Ok, so I went through the tutorial. It went into great detail, except for the part that would actually answer my question.

So I went back to the dependable way of learning: trial and error. I found that the answer to my first 2 questions were both "yes."

1)In your custom template fields, the strings you pass in the "Bind" and "Eval" methods MUST match the parameter names in the actual insert/update methods (in the Category class).

2) They don't have to match case. I even used Eval("TiTlE") etc. and things still worked.

Also, every templatefield must have a corresponding parameter placement (in the Category class's insert/update methods). No more, No less. But, I realized that since the spelling of these names match, I could change the order of my templatefields, or even Category class's insert/update method parameters, and things still work.

  #6 (permalink)  
Old May 30th, 2007, 08:13 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello


http://www.manuelabadia.com/blog/Per...5ceaf21cc.aspx

i hope that's can help you.

 


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
can not login automatically lukemai ASP.NET 1.0 and 1.1 Professional 2 December 19th, 2007 02:42 PM
send mail automatically surendran PHP How-To 1 September 21st, 2007 06:34 AM
Automatically Subtract the Value deepcover1 Access 4 March 14th, 2006 08:33 AM
Transform Automatically DJAJ XSLT 0 March 10th, 2006 09:38 PM
Automatically change value abhisheksud Classic ASP Databases 0 December 13th, 2005 02:33 AM



All times are GMT -4. The time now is 02:23 AM.


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