 |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
 | This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
|
|
|
|
|

February 25th, 2009, 12:49 PM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
|
|
Web service not displaying an alert
Ok I am reading through the AJAX chapter now and have got to the bit about web services.
My understanding of a web service is that is making a method publicly available to call upon aslong as it is referenced by the particular page that wants to use it so it knows where to look. Is this the basic concept of it?
Secondly mine isn't working for some reason
The web service itself works and the JavaScript is correct (copied it from the source file to be sure) and I have uncommented the line allowing the web service to be called from script by ASP.NET AJAX in the app data file.
I am really confused as to why it isn't working. It builds and runs fine it just doesn't display the alert after clicking the button. JavaScript is enabled in my browser do you have any idea what it might be?
|
|

February 25th, 2009, 01:06 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, that's pretty much the idea. For example, consider this service:
http://imar.spaanjaars.com/WebServic...icContent.asmx
It allows you, from an application, to retrieve content like my latest articles and the track I am currently playing in WinAmp (quite useless, but fun nonetheless. Take a look here for more info: http://imar.spaanjaars.com/QuickDocID.aspx?QUICKDOC=277).
Anyway, back to your service: what happens when you right-click the asmx file and choose View in browser? Does it show up?
Did you add the service reference to the ScriptManager like this:
<asp:ServiceReference Path="~/WebServices/NameService.asmx" />
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
Will (February 25th, 2009)
|
|

February 25th, 2009, 03:10 PM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
|
|
Yup the web service itself works, the service reference is there, the javascript is correct and enabled in my browser I really can't see why it isn't working.
|
|

February 25th, 2009, 03:39 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Can you send me the zipped source for the site so I can take a look?
You can send me a message through my profile page to which I'll reply so you know my e-mail address.
Cheers,
Imar
|
|

February 25th, 2009, 05:32 PM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
|
|
I wish I could lol but I can't seem to find a send message to you on your profile page unless I am being really blind..
|
|

February 25th, 2009, 06:14 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Will,
Maybe that option isn't available to new users of this forum?
You can also go to http://imar.spaanjaars.com and click the Contact tab. It won't be until tomorrow that I have time to look at it though; it's almost midnight here....
Cheers,
Imar
|
|

February 25th, 2009, 06:24 PM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
|
|
fair enough. I have kept plodding away trying to figure it out and its bugging me because it is probably going to be really simple. Hope you can find something when you have time.
I have sent you an email.
|
|

February 26th, 2009, 05:19 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Will,
Thanks for the source. I looked at the WebServices page and found this:
Code:
<input id="btnSayHello" type="submit" value="Say hello" />
The type is set to submit which causes a postback to the server. If the page is processed fast enough, while the Web Service takes some time, it may be too late for the alert to appear (although it worked for me the first time I tried it). Try changing it to:
Code:
<input id="btnSayHello" type="button" value="Say hello" />
and see if that helps....
Cheers,
Imar
|
|

February 26th, 2009, 05:30 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
|
|
And the whole point of the javascript is that it occurs on the client side right?
It works fine now.
Thank you.
|
|

February 26th, 2009, 05:34 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, exactly. You could easily create a web form that accepts the user's name and creates a message. But the idea of this example is that you can access server side functionality without a postback, making responses seem quicker and smoother...
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
Will (February 26th, 2009)
|
|
 |