Real-time loading Page Based on AJAX without refreshing

Source: Internet
Author: User
Tags call back
Anthem. NET is really a good thing. It is not only open-source but also easy to use, and can easily create various Ajax applications.
A small amount of code is required. First, write the logic in the control's server event, and then add the Control ID. updateaftercallback = true; to automatically call back and update the control. The autocallback attribute is also provided for controls with the autopostback attribute. With these two attributes, the control has no refresh update and data transmission functions.
Anthem. Net also provides the anthem. Manager. addscriptforclientsideeval () method, which can execute JavaScript Functions on the server anytime and anywhere. This method has a huge role.
With the powerful tool, it is easy to wait for the page without refreshing.
Add a loading image or table on the front-end page <Div id = "pnlajaxload" style = "display: none">
<Div id = "msg1"> <font face = "verdana, Arial, helvetica "color =" # ea9b02 "size =" 2 "> <B> loading </B> </font> </div>
</Div>

Then write the function to show and hide loading entries in the Javascript file. The page must contain this file. Function hideajaxloading () // hide the form
{
Document. getelementbyid ("pnlajaxload"). style. Display = 'none ';
}
Function showajaxloading () // display form
{
VaR ELEM = Document. getelementbyid ("pnlajaxload ");
If (ELEM)
{
ELEM. style. Display = 'block ';
ELEM. style. Visibility = 'visable ';
}}

Finally, add the following code to the event, which can be a pageload event, a button click event, or an index changed event based on different project requirements. Btnlast. Attributes. Add ("onclick", "showajaxloading ();");
Dropchangepage. Attributes. Add ("onchange", "showajaxloading ();");

// Note that you must add the JS function that is executed when the control event is triggered.
Public void pagerbuttonclick (Object sender, eventargs E)
{
// Logic processing code
Anthem. Manager. addscriptforclientsideeval ("hideajaxloading ();");
}
Here we are all done, and the results are perfect cheers!

There are also some problems related to the use of anthem. net. Because they are all js-based operations, many methods on the server end cannot work, such as the common response. Write. If global variables are declared on the page, the global variables are assigned the default value during callback, resulting in data loss. However, controls on the page can save their own information through viewstates.

Anthem. net also provides additional practical controls such as autosuggesttextbox, editlabel, progressbar, calendar, yuiautocomplete, etc. In order to make it easier for developers to use, it also provides a lot of instance code and Online Demo, this is very valuable and can be quickly used by beginners and experienced developers.

In short, using anthem. Net for Ajax development is a wise choice ~
Site: http://anthem-dot-net.sourceforge.net/http://www.cnblogs.com/RChen/category/69922.htmlCreated by jecray

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.