Home >Web Front-end >JS Tutorial >js AspxButton client operation_javascript skills

js AspxButton client operation_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 18:50:591803browse

JavaScript calls the parent window (parent page) method
The difference between window.parent and window.opener JavaScript calls the main window method
1: window.parent is the iframe page that calls the parent page object
2: window.opener It is the child page opened by window.open that calls the parent page object
. I will not write the specific example.


Client-side verification of AspxButton in DevExpress.Web control
When we use .net default AspButton for page submission, if client-side verification is required, we usually do this
Just write it, as follows:

If the verification fails, just return false directly in the JS function validate, but AspxButton does not work.
It took a lot of effort to find the right one. The method is as follows:



Preferably, set the AutoPostBack property of AspxButton to False, and then add a client-side Click event,
this event It is to perform some verification on the client,
function validate(s, e){
var select = document.getElementById("ddlSection");
if (select.value == "0") {
alert("Please select a valid value!");
e.processOnServer = false;
return false;
}
e.processOnServer = true;
}
In this In the event, a very important attribute is processOnServer. By setting the value of this attribute (true/false), you can tell AspxButton whether to execute its event program on the server side.

Details of processOnServer:
true: handle events on the server side;
false: handle events on the client side.

Remarks
processOnServer allows you to specify that the current Button should handle client-side events or server-side events. If this property is set to false, a client event handler is executed, and the event is completely processed on the client and not sent to the server. Set the processOnServer attribute to True, and the final event processed is on the server side, that is, the registered server-side event is triggered.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn