Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 19th, 2010, 08:07 PM
Authorized User
 
Join Date: Apr 2010
Posts: 15
Thanks: 8
Thanked 0 Times in 0 Posts
Smile Ajax-client side JavaScript clarification

Hey all!
I'm studying the Ajax in chapter 10.

in the TryItOut in page 352, we use HTML controls, and according to the book, and I quote: "you can see that the code you are going to write really
executes at the client".
I don't understand if we must work with HTML controls whenever we want to work with client side JavaScript that call web services??

One more thing, in page 352, there is this quote: "By referencing the service in the master page, it becomes available to all pages based on that master.
This also means that each page will download the JavaScript files needed to run this service."

what does it mean JavaScript files, I'm asking because all I saw is client side JavaScript code that invokes the web service, but not actual JavaScript files, that were downloaded.

10x u in advance

Last edited by stormage; September 19th, 2010 at 08:39 PM..
 
Old September 20th, 2010, 03:34 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
you can see that the code you are going to write really executes at the client".
I don't understand if we must work with HTML controls whenever we want to work with client side JavaScript that call web services??
No, that's not the case. You can also have server controls like the <asp:Button /> trigger web service calls. However, what I was demonstrating is that it works purely at the client, so you don't *have* to use server controls, but you could if you wanted to.

Quote:
what does it mean JavaScript files, I'm asking because all I saw is client side JavaScript code that invokes the web service, but not actual JavaScript files, that were downloaded.
TThere are; just look in the source of the page in the browser and you'll see a number of <script /> elements.[
QUOTE]
Here there are no events of any kind, so I guess that the fact that we registered a web service (which is accessible by client-side code ) to the web page, makes the JavaScript client code(the one that includes the HelloWorld function) at the highest priority to execute because both the JavaScript function and the web service method have the same name (HelloWorld).
[/QUOTE]
No, that's not how it works. Registering the web service just makes sure that the necessary scripts to talk to it are included (using JavaScript proxies). There's no such thing as a priority. You click the button which calls a JavaScript function which in turn talks to the web service using the JavaScript proxy class that ASP.NET has created and referenced for you when you registered the service.
Quote:
We know from earlier examples in the book, that when we have a Text Box and a Button, and we type something inside the Text Box and then click the Button, a postback occurs, and on the server the correct events are executed.
Yes, correct. But a button doesn't (typically) use JavaScript. A button is rendered as <input type="submit" ... /> which submits to the server by design.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error message: ASP.NET Ajax client-side framework failed to load ceboc ASP.NET 4 General Discussion 18 September 1st, 2010 08:25 AM
ASP.NET Ajax client-side framework failed to load ceboc BOOK: Beginning ASP.NET 4 : in C# and VB 2 August 29th, 2010 05:44 AM
ASP.NET Ajax client-side framework failed to load mkarmali BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 1 April 6th, 2010 09:01 AM
Client side DAtabinding with ASP.NET ajax 4.0 aldwinenriquez ASP.NET 3.5 Professionals 1 June 11th, 2009 01:24 AM
In ASP,Client side javaScript code casimir Classic ASP XML 0 October 24th, 2005 12:24 AM





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