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 April 9th, 2011, 08:45 AM
Registered User
 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default NameService not defined error

I'm trying the web service TryItOut and cannot get a reference to the NameService I've created. I cannot have it recognized by Intellisence and when I run the application I only receive a message that says ["NameService" is not defined].

This is the code on the WebServices web form:
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebServices/NameService.asmx" />

</Services>
</asp:ScriptManagerProxy>
<input id="YourName" type="text" />
<input id="SayHello" type="button" value="SayHello" />

<script type="text/javascript">
function HelloWorld()
{
var yourName = $get('YourName').value;
NameService.HelloWorld(yourName, HelloWorldCallback);
}

function HelloWorldCallback(result)
{
alert(result);
}

$addHandler($get('SayHello'), 'click', HelloWorld);

</script>

</asp:Content>

and, off course, the NamesService.asmx is located in the WebServices folder.

Any clue?

Regards, Antonio Plais, from Brazil
 
Old June 5th, 2011, 07:30 AM
Registered User
 
Join Date: Jun 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Name space issue

In your WebService.asmx file (one line), does it have Class="AspTutorial.WebServices.NameService" as an attribute? If so, one way to get the example to work is to use the fully qualified namespace in your JavaScript, ex:

AspTutorial.WebServices.NameService.HelloWorld(you rName, HelloWorldCallBack);





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
error function not defined Dj Kat Ajax 6 March 6th, 2006 12:02 PM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





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