Button Summary of Ext. Net learning notes

Source: Internet
Author: User

1. Trigger client events
Copy codeThe Code is as follows:
<Ext: Button ID = "Button1" runat = "server" Text = "hurry up with me">
<Listeners>
<Click Handler = "Greet ()"> </Click>
</Listeners>
</Ext: Button>

<Script type = "text/javascript">
Function Greet (){
Alert ("Hello World! ");
}
</Script>

2. Trigger server events
Copy codeThe Code is as follows:
<Ext: Button ID = "Button1" runat = "server" Text = "hurry up with me">
<DirectEvents>
<Click OnEvent = "MyButtonClickHandler"> </Click>
</DirectEvents>
</Ext: Button>

Protected void MyButtonClickHandler (object sender, DirectEventArgs e)
{
X. Msg. Alert ("Hello", "HelloWorld! ");
}

Note: The client will pop up a message box, and the background function has been executed during debugging. The foreground does not respond and the cause is unknown.

DirectEventArgs can also be replaced with System. EventArgs, but some attributes such as ExtraParams cannot be accessed. The following describes the usefulness of this parameter.

3. Trigger server events and PASS Parameters
Copy codeThe Code is as follows:
<DirectEvents>
<Click OnEvent = "MyButtonClickHandler">
<ExtraParams>
<Ext: Parameter Name = "param1" Value = "value1"> </ext: Parameter>
</ExtraParams>
</Click>
</DirectEvents>

You can use the following method to obtain parameters in the background: e. ExtraParams ["param1"]

 

According to the F12 tool of IE, the parameter is indeed sent to the server.

4. Custom additional attributes
Copy codeThe Code is as follows:
<Ext: Button ID = "Button1" runat = "server" Text = "hurry up with me">
<Listeners>
<Click Handler = "CusProperty (this);"> </Click>
</Listeners>
<CustomConfig>
<Ext: ConfigItem Name = "cusProperty1" Value = "theValue" Mode = "Value"> </ext: ConfigItem>
</CustomConfig>
</Ext: Button>

<Script type = "text/javascript">
Function CusProperty (obj ){
Alert (obj. cusProperty1 );
}
</Script>

The custom attribute value is obtained successfully.

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.