Client operations of js AspxButton

Source: Internet
Author: User

Javascript calls the parent window (parent page) Method
Differences between window. parent and window. opener javascript calls the Main window Method
1: window. parent is the parent page object called by the iframe page
2: window. opener is a child page opened by window. open. It calls the parent page object.
The specific example will not be written.


Client verification of AspxButton in DevExpress. Web Control
When we use the. net default AspButton for face-to-face page submission, we usually need
This can be written as follows:
<Asp: Button ID = "Button1" runat = "server" Text = "Submit" OnClientClick = "validate ();"/>
If the verification fails, return false directly in the JS function validate, but AspxButton does not,
It takes a lot of effort to find the appropriate method, as shown below:
<Dxe: ASPxButton ID = "btnApply" runat = "server" OnClick = "btnApply_Click" Text = "add" AutoPostBack = "False">
<ClientSideEvents Click = "validate"/>
</Dxe: ASPxButton>
First, set the AutoPostBack attribute of AspxButton to False, and then add a client Click event,
This event is to perform some client verification,
Function validate (s, e ){
Var select = document. getElementById ("ddlSection ");
If (select. value = "0 "){
Alert ("select a valid value! ");
E. processOnServer = false;
Return false;
}
E. processOnServer = true;
}
In this event, processOnServer is a very important attribute. By setting the value of this attribute (true/false), AspxButton can execute its event programs on the server side.

ProcessOnServer:
True: handles server-side events;
False: Process events on the client.

Remarks
ProcessOnServer allows you to specify whether the current Button should process client events or server events. If this attribute is set to false, a client event handler is executed, and the event is completely handled without being sent to the server on the client. Set the processOnServer attribute to True. The final event to be processed is on the server side, that is, the registered server-side event is triggered.

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.