Updating text on a webpage
NET AJAX client API, a bit of Java Script, and Web services that support script access.Last week's article, Building Interactive User Interfaces with Microsoft ASP.After completing a work item he closes it, which removes it from his list of open work items.In a typical web application the number of open work items in the upper left corner would only be refreshed when the user performed a postback, manually refreshed the page, or visited a new page.The database contains tasks assigned to an employee; throughout the course of the day new tasks may be assigned to an employee by other workers, by automated processes, or by other means.When an employee logs onto the site he sees a hyperlink that lists the number of open work items in the upper left corner of every page, and clicking that link takes him to a page that lists the open work items in his queue.He then worked as a freelance writer with credits including national newspapers, magazines and online work.
A complete, working demo is available for download at the end of this article. The download available at the end of this article includes a demo illustrating the concepts touched upon in this article.Last week's article, Retrieving Server-Side Data Using Web Services, showed how to efficiently communicate with the server from Java Script using the ASP. In short, you can create a Web service on the server and make it accessible from client-side script by decorating it with the that executes code every timeout number of milliseconds.Therefore, we can use this function to call the Web service every 30 seconds (or whatever duration you decide on).Now, imagine that she minimizes her browser and starts working on non-work item tasks and that, during that time, two new work items are added to her queue.
When she brings her browser back to the foreground the page has not been updated, it still reports that there are three open work items.Wouldn't it be nice if that count of open work items would interactively update as new work items assigned to the user entered the queue?