Home arrow ASP arrow Page 4 - Real Time Data Grid Part 2/2
ASP

Real Time Data Grid Part 2/2


In this article Annette wraps up the details of the real time data grid that she started to describe in part one of this two-part article. She looks at the JavaScript code that contacts our database server and allows us to update data in a database without actually refreshing the page.

Author Info:
By: Annette Tennison
Rating: 5 stars5 stars5 stars5 stars5 stars / 21
February 08, 2002
TABLE OF CONTENTS:
  1. · Real Time Data Grid Part 2/2
  2. · The JavaScript code
  3. · The JavaScript code (contd.)
  4. · The doDel JavaScript function
  5. · Using our DynamicGrid class
  6. · Conclusion

print this article
SEARCH DEVARTICLES

Real Time Data Grid Part 2/2 - The doDel JavaScript function
(Page 4 of 6 )

The doDel function works in exactly the same way as the doUpdate function, however it also confirms with the user that they really want to delete the selected record using the confirm function:

if(confirm("WARNING: You are about to delete this record for good."))

Using the confirm function

If the user agrees by clicking on the OK button, then a DELETE FROM query is built and sent to the SendRemoteRequest function:

strCriteria = eval("grid_"+recordId+"_0.name") + " = '" + ReplaceAllQuotes(eval("grid_"+recordId+"_0.value")) + "'";

strQuery = "DELETE FROM <%=m_TableName%> WHERE " + strCriteria;

blnSuccess = SendRemoteRequest(strQuery);


Just like the doUpdate function, the status text of the browser window is also changed, telling the user that the record was deleted successfully:

Changing the window status text

The one main difference that the doDel function has over the doUpdate function is that is uses modifies the style property of the deleted record so that it is no longer displayed in the browser once it is deleted. This make the page look as if it has been refreshed when it really hasn't. We use the JavaScript eval function to hide the table for the deleted record like this:

eval("gridTable_"+recordId+".style.display='none'");

That wraps up our look at the JavaScript and XMLHTTP code used to update our database without refreshing the page. Before we conclude this article, let's take a look at how we would actually go about using our DynamicGrid class.
blog comments powered by Disqus
ASP ARTICLES

- Central Scoreboard with Flash and ASP
- Calorie Counter Using WAP and ASP
- Creating PGP-Encrypted E-Mails Using ASP
- Be My Guest in ASP
- Session Replacement in ASP
- Securing ASP Data Access Credentials Using t...
- The Not So Ordinary Address Book
- Adding and Displaying Data Easily via ASP an...
- Sending Email From a Form in ASP
- Adding Member Services in ASP
- Removing Unconfirmed Members
- Trapping HTTP 500.100 - Internal Server Error
- So Many Rows, So Little Time! - Case Study
- XDO: An XML Engine Class for Classic ASP
- Credit Card Fraud Prevention Using ASP and C...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials