Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Async Service Call Question

$
0
0

I am trying to learn how to use an async call to a web service.  Following example at

http://weblogs.asp.net/yousefjadallah/archive/2010/03/06/step-by-step-how-to-use-web-services-in-asp-net-ajax.aspx

but using VB I came up with:

<%@PageLanguage="VB"Async="true"  %>

<!DOCTYPEhtml>
<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">
<title></title>
<scripttype="text/javascript">         

function CallDateTime() {
                 WebService.ServerDate(OnSucceeded);
             }           

function OnSucceeded(result) {
  var lblOutput = document.getElementById("lblOutput");
                 lblOutput.innerHTML = result;
             }
</script>

</head>

<body>  

<formid="form1"runat="server">  

<div>    
     <asp:ScriptManagerrunat="server"ID="scriptManager">
 
<Services>
   
<asp:ServiceReferencePath="WebService.asmx"/>
  
</Services>
 </asp:ScriptManager>
 
<asp:ButtonID="Button1"runat="server" Text="Get Date"  
     OnClientClick
="CallDateTime()"/>

 <asp:LabelID="lblOutput"runat="server"Text="Label"></asp:Label>

</div>

</form>

</body>

</html>

 

The service "WebService.asmx" just returns the server date and time.

 

When I run this test the service gets called and returns the date time. The function OnSucceeded executes, and updates the innerHTML in lblOutput.

However, this label does not get redisplayed in the browser.  It continues to display "Label". 

 

What am I doing wrong?

 

BTW when I copy code from web page to this panel, linefeeds are profuse, and it must be tediously edited.  How can I do a simple copy/paste of the code?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>