Real-time Query log system

Source: Internet
Author: User
Recently made a module, real-time query log system.
The idea is: 1: When loading Web pages, read x records from the database, displayed in the page. 2: Set refresh time, dynamically read records from the database, in the client
Local refresh. Because it is local refresh, Ajax technology is used.
The following measures are:
1: Download Ajax.dll dynamic connection Library from website http://ajax.schwarz-interactive.de/csharpsample/default.aspx.
2: Configure Web.config
<system.web>
<add verb= "Post,get" path= "Ajax/*.ashx" type= "Ajax.pagehandlerfactory, Ajax"/>
</system.web>
3: Add the following code to the Web page
<HEAD>
<script language= "javascript" src= "Ajax/common.ashx" ></script>
<script language= "javascript" src= "Ajax/ajaxwebapp.demo,ajaxwebapp.ashx" ></script>
</HEAD>
Note: Ajaxwebapp.demo: Ajaxwebapp is the name of the namespace, demo is a class name.
4: Add Ajax.Utility.RegisterTypeForAjax (typeof (Ajaxwebapp.demo)) statement to Page_Load.
5: Start writing the method in the demo class:
Format: [Ajax.ajaxmethod]
public string GetDataSet ()
{
The code that reads the data.

return HTML;
}
6: This method is called in the HTML code of the Web page.
<script language= "JavaScript" >
Demo.getdataset (Getdataset_callback);
function Getdataset_callback (response)
{
var retvalue = Response.value;
Handling RetValue Code
}
</script>
7: The basic operation of Ajax has been completed by now.
8: The following implementation dynamically from the server side to obtain data:
Using JavaScript to leverage
SetInterval ("GetData ();", refreshtime);
The code in part 6th should read
<script language= "JavaScript" >
function GetData ()
{

Demo.getdataset (Getdataset_callback);
}

function Getdataset_callback (response)
{
var retvalue = Response.value;
Handling RetValue Code
}
SetInterval ("GetData ();", refreshtime);
Refreshtime is a custom refresh time
</script>
This, plus the code you want to process the data, you can!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.