The series of controls developed by devexpress are indeed very powerful, especially some data-bound controls, or even 0 Code You can achieve a very "strong" effect. I also need to use it in my work, so I just want to learn and sort it out. I just want to settle it. Some places may be wrong. I hope you can correct them!
Today I will mainly talk about the aspxbutton control, which is also Program The most widely used event, but the first use of the event does bring a little trouble. For example, when the client needs JavaScript code for necessary verification, we only need to add the onclientclick event when using aspbutton, the following code returns false in the program: < ASP: button ID = "Btnsubmit" Runat = "Server" Text = "Submit" Onclientclick = "Return btnclick ();" />
Function Btnclick (){
If (Txtmemo. gettext () = "" ){
Alert ( " Enter a valid value! " );
Return False ;
}
}
When the btnclick event returns false, the program will no longer refer to the server-side code. However, aspxbutton does not support event registration and processing. When registering an event, add the <clientsideevents/> subnode in the <dxe: aspxbutton/> tag. As follows:Code
< Dxe: aspxbutton ID = "Btnsubmit" Runat = "Server" Clientinstancename = "Btnclientsubmit"
Text = "Submit" >
< Clientsideevents Click = "Function validate (S, e ){
If (txtmemo. gettext () = ''){
Alert ('enter a valid value! ');
E. processonserver = false;
}
}" />
</ Dxe: aspxbutton >
The above code will display an aspxbutton and register the client event click. In the click event, determine whether the txtmemo content is equal to ''. If it is equal to'', the user will be prompted, and set properties E. processonserver = false to prevent code running on the server.
E. processonserver (true/false)
gets or sets whether the program is executed on the server. After reading relevant information, if the aspx system control has the autopostback attribute, you can use E. processonserver to control whether the code is executed on the client or on the server. However, the processonserver depends on the autopostback attribute . If the control autopostback = "false", the processonserver attribute value does not work.
In addition to click, The aspxbutton client events include checkedchanged, gotfoucs, init, and lostfoucs. In addition, aspxbutton provides a series of client methods to set aspxbutton attributes, such as settext (value): Set the display value of the button; gettext (): Get the display value; setvisbile (bool ): set whether to display; getvisbile (): Get whether to display;
incallback (): Get a value, indicating whether a callback is being processed.