Magicajax usage (translation + posting)

Source: Internet
Author: User
My English skills are not high. Please point out the mistakes in translation. Smile at the translation.
It is mainly for you to see, so you know what it means. There must be a lot of bad words.

Usage
Usage

Table of contents
Directory

Programming
Design

Handling an ajaxcall
Operation ajaxcall

Setting an Ajax refresh Timer
Set timed Ajax refresh

Controls
Widget

AjaxPanel
Ajaxzone
Clienteventtrigger
Keyclienteventwrapper
Ajaxpage and ajaxusercontrol
Ajaxhtmlanchor and ajaxhtmlimage

Magicajax attributes for ASP. NET controls
Magicajax attributes of ASP. NET controls

Programming
Design

Handling an ajaxcall
Ajaxcall operation

 

Depending on the pagestore mode configuration option, the page's execution cycle will differ significantly (see configuration options ).
Depending on the page's store status options, the page's execution cycle will be inconsistent. (See the structure options)

For the default 'nostore' mode, the page's execution cycle will be the same as a PostBack.
For the default 'nostore' status, the page execution cycle is equivalent to PostBack.

You can distinguish if a PostBack or an ajaxcall occured, by checking the return value of the magicajaxcontext. Current.
By checking the return value of magicajaxcontext. Current, you can distinguish between PostBack and ajaxcall.

Isajaxcallforpage method.

Note:
Note:

There is a magicajaxcontext. Current. isajaxcall property that is true if the HTTP request was originated by an ajaxcall, but the recommended method of checking whether an ajaxcall was invoked is by using done.
When the magicajaxcontext. Current. isajaxcall attribute is true, if the HTTP request starts through ajaxcall, the recommended method for checking whether ajaxcall is called is determined by the isajaxcallforpage attribute.

If the page is created because of a server.
Because the page is generated on the server.

Transfer call that occured during an ajaxcall, isajaxcallforpage will return false so that your page can execute as a normal page request.
When the ajaxcall page is transferred, the isajaxcallforpage attribute returns "false" so that your webpage can run normal requests.

The ajaxpage. isajaxcall property, that makes a call to isajaxcallforpage, is provided for convenience (see ajaxpage ).
Ajaxpage. isajaxcall attribute, which is used as a call signal to isajaxcallforpage for convenience. (See ajaxpage)

Magicajax sends JavaScript code to the client as a response to an ajaxcall.
Magicajax ajaxcall sends JavaScript code to the client through response.

If you want to send your custom JavaScript along with magicajax's, you can use the static functions of ajaxcallhelper.
If you want to send your custom JavaScript together with magicajax's, you can use the static method of ajaxcallhelper.

For example:
For example:

Private void button#click (Object sender, system. eventargs E)

{

Ajaxcallhelper. writealert ("button1 was clicked .");

}

--------------------------------------------------------------------------------

Setting an Ajax refresh Timer
Set timed Ajax refresh

You can use the ajaxcallhelper. setajaxcalltimerinterval method to set a page wide timer that will invoke ajaxcils at the intervals that you define.
You can use the ajaxcallhelper. setajaxcalltimerinterval method to set the page to evoke the wide timer of ajaxcils at the interval you define.

You can call it either at the initial Page request or during an ajaxcall to initiate it or change the interval value.
You can also change the timer value before the start of the Request page or during ajaxcall.

If you call it with an interval value of zero, the timer will deactivate.
If you set the value to zero, the timer will not work.

Example:
Example:

Private void page_load (Object sender, system. eventargs E)
{
If (! Ispostback)
{

// Ajax refresh every 10 seconds
// Ajax refresh every 10 seconds
Magicajax. ajaxcallhelper. setajaxcalltimerinterval (10000 );
}
}

Controls
Widget

 

AjaxPanel

This is the core control of the magicajax framework.
This is the core control of the magicajax framework.

 
The PostBack functionality of all the controls that are inside an AjaxPanel will be replaced by an Ajax callback (ajaxcall), unless defined otherwise.
The PostBack function of all controls in the AjaxPanel will be replaced by an Ajax callback (ajaxcall) unless otherwise defined.

AjaxPanel works like the ASP. NET panel, its contents are visible on the designer, you can set all the webcontrol attributes to it, change its visible property etc.
AjaxPanel works like an ASP. NET panel. The control in it is visible during design. You can set all its webcontrol attributes, change its visibility, and so on.

 

Its ajaxcallconnection property can be set:
Its ajaxcallconnection attribute can be set:

Asynchronous (default)
Asynchronous (default)

The ajaxcall will be invoked in the background
Ajaxcall will be called in the background

Synchronous
Synchronized

The client's browser will wait for the ajaxcall to finish
The client's browser will wait until the ajaxcall is called.

None
No

Controls inside the AjaxPanel will invoke a normal PostBack
The control in the AjaxPanel will use the normal PostBack

 

Its excludeflags property determines which form elements shoshould be excluded from posting to the server during an ajaxcall, thus cing the ajaxcall traffic.
Its excludeflags attribute determines which form element should not be sent to the server during ajaxcall, thus reducing ajaxcall traffic.

It sets the excludeflags magicajax ASP. Net Control attribute.
Set the excludeflags attribute of the magicajax control of ASP. NET.

A child AjaxPanel automatically "inherits" The excludeflags of its parent AjaxPanel.
The derived class of an AjaxPanel automatically "inherits" The excludeflags of its parent class AjaxPanel.

The child can mark more form elements to exclude through its excludeflags property but it cannot send to the server form elements that have been marked for exclusion by its parent AjaxPanel.
When there are many form elements, you can set the excludeflags attribute to exclude whether it is sent to the server, and it cannot send the marked form elements in its parent class to the server.

 

In order to reduce the amount of HTML needed to send to client, AjaxPanel defines individual 'html holders '.
To reduce the number of HTML requests to be sent to the customer, AjaxPanel defines the individual 'html holder '.

If the HTML of a holder changes during an ajaxcall, magicajax sends the whole HTML of the holder so that it can be reflected to the client's browser.

If the client's HTML is changed during ajaxcall, magicajax sends the entire client's HTML so that it can be reflected in the client's browser in a timely manner.

Every immediate webcontrol child of an AjaxPanel is considered a separate holder, and one extra holder is defined for the literal and htmlcontrols content of the AjaxPanel.

The webcontrol of each direct subclass of AjaxPanel is an independent owner, and an additional owner is defined as the literal and htmlcontrols AjaxPanel of AjaxPanel.

Thus, if the html of a webcontrol, that is enclosed inside an AjaxPanel, changes, only the HTML of the particle webcontrol will be sent to the client.

Therefore, if the webcontrol HTML is included in the AjaxPanel and changes, only the special webcontrol HTML will be sent to the customer.

 

An AjaxPanel (Child AjaxPanel) that is inside another AjaxPanel (parent AjaxPanel), define its HTML holders separately from its parent.
In addition, the AjaxPanel (sub-AjaxPanel) of the AjaxPanel (parent AjaxPanel) internally defines its HTML holder separately from its parent.

The parent AjaxPanel will ignore the html of the child AjaxPanel; only the child AjaxPanel will be responsible for reflecting its holders on the client.
The AjaxPanel of the parent class ignores the html of the AjaxPanel of the subclass. Only the AjaxPanel of the subclass is responsible for processing client requests of the subclass.

Thus, you can reduce the traffic of ajaxcils, by adding using ajaxpanels that define more and smaller HTML holders.
Therefore, you can reduce the communication data volume of ajaxcils, thereby adding and defining many small HTML containers of AjaxPanel.

For example, if you put a table inside an AjaxPanel and change one of its cells during an ajaxcall, the complete HTML of the table is going to be sent to the client.
For example, if you place a table in ajaxpanle and change the content of a cell during ajaxcall, all the HTML of the table will be sent to the client.

On the other hand, if you add an AjaxPanel for each cell, only the HTML of the contents of the changed cell will be sent to the client.
On the other hand, if you put an AjaxPanel in each cell, only the HTML of the changed cell content will be sent to the client.

 

In order to monitor the traffic of ajaxcallthat your page is producing, you can enable the tracing configuration option.
To detect the traffic generated by ajaxcils on your own page, you can use the tracing option.

--------------------------------------------------------------------------------

Ajaxzone

 

It's an AjaxPanel that has the magicajax attribute ajaxlocalscope set to true.
Ajaxzone is actually the AjaxPanel with the magicajax attribute ajaxlocalscope set to true.

It is provided for convenience and readability.
It provides convenience and ease of use.

When an ajaxcall is invoked from a control inside an ajaxzone, only the values of the form elements that are contained inside this ajaxzone will be sent to the server and the server will check for changes and "reflect" only the ajaxpanels that are inside the ajaxzone.

When the control in ajaxzone calls ajaxcall, only the values containing the elements in the ajaxzone will be sent to the server and the server side to check only the changes of the form elements in the ajaxpanels in the ajaxzone.

This helps reduce the Ajax traffic and speed up a bit the server's response.
This will help reduce Ajax traffic and quickly respond to server feedback.

It's intented for isolated and independent portions of a page, like usercontrols.
Page isolation and independent parts, such as usercontrols.

An ajaxzone can contain other ajaxzones.
Ajaxzone can contain other ajaxzones.

A control belongs to the ajaxzone that is its immediate parent.
The control is affiliated with the ajaxzone of its parent control.

--------------------------------------------------------------------------------

Clienteventtrigger

Captures a client event of a control.
Obtains a client event of the control.

The eventname property must be set to the client event (I. e. "Focus", "change", etc .) and the controlid property must be set to the ID of the control whose event you want to capture.
The event name attribute must be set to a customer event (that is, "Focus", "change", and so on), and The controlid attribute must be set to the Control ID of the client event you want to capture.

The ajaxcall that will be invoked is dependent at the clienteventtrigger's placement, not the placement of controlid's control.
The call of ajaxcall will depend on the placement of clienteventtrigger's instead of the controlid's control.

For example, if the clienteventtrigger is inside an AjaxPanel an ajaxcall will be invoked even if the controlid's control is not inside an AjaxPanel.
For example, if the clienteventtrigger is in the AjaxPanel, The ajaxcall will be called even if the controlid's control is not in the AjaxPanel.

The clienteventtrigger must be inside the same namingcontainer (I. e. usercontrol) as the controlid's control.
Clienteventtrigger must be like the namingcontainer (such as usercontrol) Control of controlid's.

--------------------------------------------------------------------------------

Keyclienteventwrapper

Captures the keypress, keydown, and keyup client events of its inner controls.
Obtain the keypress, keydown, and keyup client events of the control.

The keypress event has the IE behaviour hour SS all browsers (invoked when a character is typed or enter is pressed ).
The keypress event passes the IE behavior of all browsers. (Call the type of the lower pressure that is typed during typing)

--------------------------------------------------------------------------------

Ajaxpage and ajaxusercontrol

Making your pages and usercontrols inherit from ajaxpage and ajaxusercontrol is not required; they're provided only for convenience.
Creating Your page and usercontrols can be inherited from ajaxpage and ajaxusercontrol, but this is not necessary; they are provided only for convenience.

They expose the magicajax's stored page events (see session/cache pagestore modes) and provide the isajaxcall property that makes a call to magicajaxcontext. Current. isajaxcallforpage.
They published the storage page events of magicajax (see session/cache pagestore modes) and provided magicajaxcontext. Current. isajaxcallforpage as the attribute of isajaxcall for magicajax ..

 
--------------------------------------------------------------------------------

Ajaxhtmlanchor and ajaxhtmlimage

 

These controls are intented to be used only for the session/cache pagestore modes.
These controls are only used in the pagestore as the session/cache page mode.

When these modes are selected, ASP. NET's htmlanchor and htmlimage loose their href and SRC attributes during an ajaxcall.
When these modes are selected, href and SRC of ASP. NET's htmlanchor and htmlimage will be lost during ajaxcall.

Ajaxhtmlanchor and ajaxhtmlimage can be used in their place.
Ajaxhtmlanchor and ajaxhtmlimage can be used in these places.

--------------------------------------------------------------------------------

Magicajax attributes for ASP. NET controls
Magicajax attributes of ASP. NET controls

 

You can add special attributes to ASP. NET controls that define how they will be handled by magicajax:
You can add special attributes to the ASP. Net Control to define how they will be processed by magicajax:

 

Ajaxcall ("async" or "sync" or "NONE ")
Ajaxcall ("Asynchronous" or "synchronous" or "no ")

If you add the ajaxcall attribute with "async"/"sync" value to a control that has PostBack functionality (I. e. button, linkbutton, checkbox, etc .) the PostBack functionality of the control will be replaced by Ajax functionality, even if it is not contained inside an AjaxPanel.

If you add the ajaxcall attribute and Its Value "async"/"sync" to a control with the PostBack function (such as a button or a selection box ), the PostBack function of this control will be replaced by the Ajax function, even if it is not included in the AjaxPanel container.

If you add the ajaxcall attribute with "NONE" value to a control that is inside an AjaxPanel, the control will perform a PostBack instead of an ajaxcall.
If you add the ajaxcall attribute and Its Value "NONE" to the control in the AjaxPanel, and evaluate the control in the AjaxPanel, the control uses the PostBack function ajaxcall.

By adding the ajaxcall attribute, you override the ajaxcallconnection property of its parent AjaxPanel (if the AjaxPanel is set to asynchronous, you can add ajaxcall with "sync" value to a control to make it perform a synchronous ajaxcall ).
By adding the ajaxcall attribute, You can overwrite the ajaxcallconnection attribute of the AjaxPanel and its parent class. (If the AjaxPanel is set to asynchronous, you can add the "synchronous" ajaxcall value while the control is running)

The effect of the ajaxcall attribute is applied to all the children of the control, so if you add it to a plain ASP. net panel, all the controls that are contained inside this panel will get the effect of the ajaxcall attribute.

The effect of the ajaxcall attribute applies to all sub-classes of the control. Therefore, if you simply add it to the ASP. NET panel, all controls contained in the Panel will get the effect of the ajaxcall attribute.

 

Excludefrompost ("true" or "false ")

When an ajaxcall is invoked, the client sends the values of the form elements to the server as post data.
When ajaxcall is called, the value of the elements in the customer form will be post to the server.

If there is a control that is used only to display information and not to get input from the user, you can add the excludefrompost attribute with "true" value and the value of this control will not be sent to the server.
If this control is only used to display data and does not require users to enter information, you set the excludefrompost attribute to true for this control, the value of this control will not be sent to the server.

For example, if your page contains a readonly textbox that is used to display chat messages, sending its contents for every ajaxcall is unnecessary traffic; you can avoid it by using the excludefrompost attribute.

For example, if the read-only text box on your page is used to display information, the content sent by ajaxcall is unnecessary communication. You can avoid sending related information by using the excludefrompost attribute.

 

Ajaxlocalscope ("true" or "false ")

Makes the control behave like an ajaxzone.
The created Control performs the same behavior as the ajaxzone.

Excludeflags (expression --- expression)

Determines which form elements will be excluded from posting to server during an ajaxcall.
Determine which form elements will be excluded during execution of the ajaxcall server.

These form elements will be excluded when an ajaxcall is invoked from the control or one of its children.
When ajaxcall is called from its control or one of its child controls, these form elements will be excluded.

It shoshould be set to an arithmetic expression that has an integer as a result.
It sets a complete mathematical expression and should be able to get a complete result.

The javascript constants excfviewstate, excffingerprints, excfuserhidden, excfallhidden, excfformelements, excfallelements can be used for convenience.

Javascript constants excfviewstate, excffingerprints, excfuserhidden, excfallhidden, excfformelements, and excfallelements can be conveniently used.

 

Example:
Example:

<Asp: button excludeflags = "excfformelements | excfviewstate"...>

All the attributes can be added inside the control's tag statement or by code.
All attributes can be added in the label statement of the control or in the background code.

Their values, and consequently their function, can be changed during an ajaxcall.
Their values and their functions can be changed during ajaxcall.

Example:
Example:

Button1.attributes ["ajaxcall"] = "async ";

 

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.