asp.net & web services

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

Hi all!

Currently I have a web application that consists of a classic frameset. I
would like to rebuild the application and just use tables or layers. The
problem is, that some parts of the application need to be refreshed at a
given interval. Currently, these parts run in a separate frame and a
JavaScript function reloads the page every x seconds. In the new scenario I
could use iframes, but I would prefer another solution to avoid page
reloading. Was it possible to call a web service from a JavaScript function?
The web service would return a HTML string that the JavaScript function will
then write into a <div>-Element. This way I could avoid page reloads and the
JavaScript function could poll the web service every x seconds in order to
obtain and display the latest data.

Can this be done and if so, where can I find some sample code?

Thanks

Thomas
 
What is wrong with an IFrame with src = source.aspx and in the HTML code for
the source.aspx page in the <Head> section put the code <META
http-equiv="Refresh" content="10"> to refresh the source page every 10
seconds. I don't think this reloads the entire page, does it--just what is
in the IFrame? It happens so fast I can't really tell.
 
If you're targeting IE then use webservices and the behaviors file (".htc")

Here's one example...You can lookup details at MSDN, search for
webservice.htc
<!--
// This div will host the 'webservice' behavior for this page. Put this on
your page.

<div id="divWebService" style="display: none;
behavior:url(../WebServices/webservice.htc)"></div>
function DoWebService()
{

var objWebService;
var intListID;

// Get the ID of the list that is to be returned
//
intListID = 1;

// Get a pointer to our webservice object
//
objWebService = document.all.divWebService;

// Assign the callback function for this webservice call.
//
objWebService.onresult = divWebService_Result_DoWebService;

// Set up the call to the webservice
//
objWebService.useService("../WebServices/DataServices.asmx?wsdl","server");

// Execute the specified method
//
objWebService.server.callService("GetListInformation", intListID);


}

Iguana
 
William LaMartin said:
What is wrong with an IFrame with src = source.aspx and in the HTML code for
the source.aspx page in the <Head> section put the code <META
http-equiv="Refresh" content="10"> to refresh the source page every 10
seconds. I don't think this reloads the entire page, does it--just what is
in the IFrame? It happens so fast I can't really tell.

Well, in principle there's nothing wrong with iframes. Indeed only the
iframe is refreshed, not the whole page. For my scenario it was possible to
use iframes, but not using them had one more two additional benefits (not in
general, just in my application) - that's why I'm looking for an alternative
solution.
 
Another way that needs a lot of javascript code is to use the MS XML
PARSER's HTTPRequest object. I've been using this method to avoid the
refresh of a page, and filling it with real time data (that changes every 1
second).

The results are impressive, since the data changes without a reload.
 
Thanks, this sounds suitable for me as the application runs in the intranet
and all client browsers are IE.
 
Back
Top