I am trying to learn how to use an async call to a web service. Following example at
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?