Use ajax.net to design the report for executing current operations

Source: Internet
Author: User
We know that some reports are too slow in computing, so we will let a page first calculate and cache it in one place, and then let the customer read the cache because the speed is too slow, I want to reflect in the computing module which is being computed. The first thing I want to think about is to jump to one module on a page one by one, in this way, we can see the current execution status on the interface, which may meet the requirements. Now I will make a slight transformation and use a page to complete it. Program Control Points
1. Configure in Web. config first < Httphandlers >
< Add verb = " Post, get " Path = " Report/*. ashx " Type = " Ajax. pagehandlerfactory, Ajax "   />
</ Httphandlers >  

Do not forget to add
Protected void application_start (Object sender, eventargs E)
{
Ajax. Utility. handlerpath = "report ";
}
2. It is just a program. In fact, it does not need to be changed at all as long as it is added. As mentioned by a development manager, it is not a change if it is added, is expansion. What should I add? Private   Void Page_load ( Object Sender, system. eventargs E)
{
Ajax. Utility. registertypeforajax (Typeof(Report. webform1 ));
}

First Registration [Ajax. ajaxmethod]
Public   String Aaaaa ()
{
Dataset result =   New Dataset ();
Sqldataadapter da =   New Sqldataadapter ();
Sqlcommand cmd =   This . Buildquerycommand ( " XXXXXXXX " , " 1 " );
Cmd. commandtimeout =   1000 ;
Da. selectcommand = CMD;
Da. Fill (result );
Return   " Aaaaa " ;
}
[Ajax. ajaxmethod]
Public   String Bbbbb ()
{
Dataset result =   New Dataset ();
Sqldataadapter da =   New Sqldataadapter ();
Sqlcommand cmd =   This . Buildquerycommand ( " XXXXXXXX " , " 1 " );

Then you can test all the methods you have previously written, and then write [Ajax. ajaxmethod] on the head. The background will be OK, mainly at the front-end, < Script Language = " Javascript " >


Function Callback_testa (RES)
{
Invalid parameters Doc ument. form1.all ("SS"). Value+ =Res. value;
Webform1.bbbbb (callback_testb );
}

Function Callback_testb (RES)
{
Invalid parameters Doc ument. form1.all ("SS"). Value+ =Res. value;
Webform1.ccccc (callback_testc );
}

Function Callback_testc (RES)
{
Invalid parameters Doc ument. form1.all ("SS"). Value+ =Res. value;
Webform1.ddddd (callback_testd );
}
Function Callback_testd (RES)
{
Invalid parameters Doc ument. form1.all ("SS"). Value+ =Res. value;
}


Function Test1 ()
{
Webform1.aaaaa (callback_testa );
}

Window. onbeforeunload =   Function ()
{

Window. event. returnvalue= False;

}
</ Script >

This mainly completes the display at the front end. Note that the called method is to use the class name you registered. You can just use your method name.
So the effect will come out.
There are not many changes, the way programming looks, and the effects of implementation are greatly changed. Although the essence is not changed, there are indeed many changes in the big environment.

Related Article

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.