469,917 Members | 1,700 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Atlas/JavaScript getting started problem

I'm trying to get started with Atlas and associated necessary javascript at
the same time. I started out at
http://atlas.asp.net/walkthroughs/ge...rted/basic.net where they have
an application (which I have pasted below) that displays a string returned
from a web service.

One problem is that the application doesn't work. It errors out at....

Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,OnRequestComplete);

saying that Samples is undefined. Can anyone tell me what is wrong?

Another thing I'm curious about is that the author of the article said it
was necessary to NOT use a codebehind file but did not say why. Why can't a
code-behind file be used?

Thanks,
T

------------------------------------------------------------------------------------
<%@ Page Language="C#" Title="Atlas Script Walkthrough" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">
<atlas:ScriptManager runat="server" ID="scriptManager">
<services>
<atlas:servicereference path="~/HelloWorldService.asmx" />
</services>
</atlas:ScriptManager>
<style type="text/css">
body { font: 11pt Trebuchet MS;
font-color: #000000;
padding-top: 72px;
text-align: center }

.text { font: 8pt Trebuchet MS }
</style>

</head>
<body>
<form id="Form1" runat="server">
<div>
Search for
<input id="SearchKey" type="text" />
<input id="SearchButton" type="button"
value="Search"
onclick="DoSearch()" />
</div>
</form>
<hr style="width: 300px" />
<div>
<span id="Results"></span>
</div>
<script type="text/javascript">

function DoSearch()
{
var SrchElem = document.getElementById("SearchKey");
Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,
OnRequestComplete);
}

function OnRequestComplete(result)
{
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}

</script>
</body>
</html>
Sep 11 '06 #1
2 1734
I am not sure what your web service code looks like, but you may have an
issue with the namespace name. If you could post that code, that would be
great.

As for the code-behind comment, I believe the author was stating that you do
not need to use the code behind for the ASPX page. Since atlas is calling a
web service you may or may not need to implement any code-behind for your
aspx page. If you are not performing any post back routines then you wouldn’t
necessarily need any code behind.

Daniel C. Di Vita
"Tina" wrote:
I'm trying to get started with Atlas and associated necessary javascript at
the same time. I started out at
http://atlas.asp.net/walkthroughs/ge...rted/basic.net where they have
an application (which I have pasted below) that displays a string returned
from a web service.

One problem is that the application doesn't work. It errors out at....

Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,OnRequestComplete);

saying that Samples is undefined. Can anyone tell me what is wrong?

Another thing I'm curious about is that the author of the article said it
was necessary to NOT use a codebehind file but did not say why. Why can't a
code-behind file be used?

Thanks,
T

------------------------------------------------------------------------------------
<%@ Page Language="C#" Title="Atlas Script Walkthrough" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">
<atlas:ScriptManager runat="server" ID="scriptManager">
<services>
<atlas:servicereference path="~/HelloWorldService.asmx" />
</services>
</atlas:ScriptManager>
<style type="text/css">
body { font: 11pt Trebuchet MS;
font-color: #000000;
padding-top: 72px;
text-align: center }

.text { font: 8pt Trebuchet MS }
</style>

</head>
<body>
<form id="Form1" runat="server">
<div>
Search for
<input id="SearchKey" type="text" />
<input id="SearchButton" type="button"
value="Search"
onclick="DoSearch()" />
</div>
</form>
<hr style="width: 300px" />
<div>
<span id="Results"></span>
</div>
<script type="text/javascript">

function DoSearch()
{
var SrchElem = document.getElementById("SearchKey");
Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,
OnRequestComplete);
}

function OnRequestComplete(result)
{
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}

</script>
</body>
</html>
Sep 11 '06 #2
It is definitely the namespace -- I had the same error.

Change:
Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,
OnRequestComplete);
to where ever your web service is located in your project -- mine was just

HelloWorldService.HelloWorld(SrchElem.value,OnRequ estComplete);



"Tina" wrote:
I'm trying to get started with Atlas and associated necessary javascript at
the same time. I started out at
http://atlas.asp.net/walkthroughs/ge...rted/basic.net where they have
an application (which I have pasted below) that displays a string returned
from a web service.

One problem is that the application doesn't work. It errors out at....

Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,OnRequestComplete);

saying that Samples is undefined. Can anyone tell me what is wrong?

Another thing I'm curious about is that the author of the article said it
was necessary to NOT use a codebehind file but did not say why. Why can't a
code-behind file be used?

Thanks,
T

------------------------------------------------------------------------------------
<%@ Page Language="C#" Title="Atlas Script Walkthrough" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">
<atlas:ScriptManager runat="server" ID="scriptManager">
<services>
<atlas:servicereference path="~/HelloWorldService.asmx" />
</services>
</atlas:ScriptManager>
<style type="text/css">
body { font: 11pt Trebuchet MS;
font-color: #000000;
padding-top: 72px;
text-align: center }

.text { font: 8pt Trebuchet MS }
</style>

</head>
<body>
<form id="Form1" runat="server">
<div>
Search for
<input id="SearchKey" type="text" />
<input id="SearchButton" type="button"
value="Search"
onclick="DoSearch()" />
</div>
</form>
<hr style="width: 300px" />
<div>
<span id="Results"></span>
</div>
<script type="text/javascript">

function DoSearch()
{
var SrchElem = document.getElementById("SearchKey");
Samples.AspNet.HelloWorldService.HelloWorld(SrchEl em.value,
OnRequestComplete);
}

function OnRequestComplete(result)
{
var RsltElem = document.getElementById("Results");
RsltElem.innerHTML = result;
}

</script>
</body>
</html>
Sep 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by sales | last post: by
1 post views Thread by amit | last post: by
1 post views Thread by Ronde | last post: by
6 posts views Thread by hangar18 | last post: by
1 post views Thread by TARUN | last post: by
1 post views Thread by TARUN | last post: by
3 posts views Thread by mkr04 | last post: by
1 post views Thread by jmdolinger | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.