Sunday, April 29, 2012

How to edit the gridview row data in client side

I always use GridView to show the transactoins or product list in hand without using third party product such as Telerik control. I have to calculate the price or grand total on GridView often. In that sample, I am developing code to show how to access every row and cell from JavaScript, and populate some data operation on these row and cell as below image.
Populating the row data in client side

Sunday, April 1, 2012

Implementing a Client Session Timeout for intensive data access

Often there is a scenario where the user displays a live page that polls the data from server every few seconds to update some contents on page. In case, the user leaves for hours without shutting down the browser. As a result, the page keeps on sending requests, generating a significant—and useless—workload for the server.
On the server, there's session timeout, but in AJAX there's also the client session that matters. To detect the end of a client session, you need to check whether there was user activity such as clicking and tapping for a given amount of time.To detect the end of a session based on a timer, set up a client timer that expires after a specified number of seconds, stops the ongoing task, and pops up an alert box. If the user responds to the prompt, processing resumes as usual. This example update the datetime every 3 seconds and then show confirm dialog box every 10 seconds to ask the user.

Client Session Timeout