Ext. Net learning essay 002 default button, ext. net002
Press enter in FormPanel to trigger the click Event of the default button. The setting method is to set the DefaultButton attribute in FormPanel. If this attribute is not set, the last button is used by default.
1. The last button is the default button by default.
X. formPanel (). buttons (X. button (). text ('first click'), X. button (). text ('default click '). onClientClick ("Ext. msg. alert ('Press enter default triggered event', 'trigger button is the last button ')"))
2. Number the number to indicate the default button
X. formPanel (). defaultButton ('2 '). buttons (X. button (). text ('first click'), X. button (). text ('default click '). onClientClick ("Ext. msg. alert ('Press enter default triggered event', 'trigger button is the last button ') "), X. button (). text ('third click '))
3. Specify the default button with ID
X. formPanel (). defaultButton ('button 2 '). buttons (X. button (). text ('first click'), X. button (). ID ('button 2 '). text ('default click '). onClientClick ("Ext. msg. alert ('Press enter default triggered event', 'trigger button is the last button ') "), X. button (). text ('third click '))
4. Specify the default button with the selector
X. formPanel (). defaultButton ('button [text = default button] '). buttons (X. button (). text ('first click'), X. button (). text ('default click '). onClientClick ("Ext. msg. alert ('Press enter default triggered event', 'trigger button is the last button ') "), X. button (). text ('third click '))
The complete view code is as follows:
@ Using Ext. Net; @ using Ext. Net. MVC; @ {Layout = null; var X = Html. X () ;}<! DOCTYPE html>