Ext.net Learning Notes Button Summary _ Practical skills

Source: Internet
Author: User

1. Triggering client Events

Copy Code code as follows:

<ext:button id= "Button1" runat= "Server" text= "Hurry Me" >
<Listeners>
<click handler= "Greet ()" ></Click>
</Listeners>
</ext:Button>

<script type= "Text/javascript" >
function Greet () {
Alert ("Hello world!");
}
</script>


2. Triggering service-side events
Copy Code code as follows:

<ext:button id= "Button1" runat= "Server" text= "Hurry Me" >
<DirectEvents>
<click onevent= "Mybuttonclickhandler" ></Click>
</DirectEvents>
</ext:Button>

protected void Mybuttonclickhandler (object sender, Directeventargs e)
{
X.msg.alert ("Hello", "helloworld!");
}


Note: It stands to reason that the client will pop up a message box, debugging has been carried out to the background function, the front desk did not respond, the reasons unknown.

Directeventargs can also be replaced with System.EventArgs, but this will not be able to access certain properties, such as: Extraparams, the use of this parameter

3. Triggers the service-side event and passes the reference

Copy Code code as follows:

<DirectEvents>
<click onevent= "Mybuttonclickhandler" >
<ExtraParams>
<ext:parameter name= "param1" value= "value1" ></ext:Parameter>
</ExtraParams>
</Click>
</DirectEvents>

Background fetch parameters can be used in the following way: E. extraparams["param1"]

 

Actually sent the parameter to the server from the F12 tool of IE.

 4. Custom Extra Properties

Copy code code as follows:

<ext:button id= "Button1" runat= "Server" text= "Hurry Me" >
<Listeners>
<click handler= "Cusproperty (this);" ></Click>
</Listeners>
<CustomConfig>
<ext:configitem name= "cus Property1 "value=" Thevalue mode= "Value" ></ext:ConfigItem>
</CustomConfig>
</ext:but ton>

<script type= "Text/javascript"
function Cusproperty (obj) {
Alert (obj.cuspropert y1);
}
</script>

The value of the successfully acquired property to the custom

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.