Button AutoPostBack to "false"
New Community Forums available at http://forums.ext.net
 

Coolite Forums

Welcome Guest ( Login | Register )
 
««12
Button AutoPostBack to "false"
Subscribe
Last Login: 7/8/2010 1:50:34 AM
Posts: 4,722,
Posted 9/19/2008 10:41:28 AM

Group: Core Development Team

The default value of the .AutoPostBack property on the <ext:Button> has been changed from "true" to "false".

In Visual Studio DesignMode, double clicking on the <ext:Button> will automatically wire up the "OnClick" event handler, but as with other postback enabled controls, such as <asp:TextBox>, the developer will now have to explicitly set the .AutoPostBack property to "true".

The following sample demonstrates a simple <ext:Button> which post's back to the server.

Example

<ext:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" AutoPostBack="true" />

The .AutoPostBack="true" property must be set if you are using the <ext:Button> in conjunction with an <asp:UpdatePanel> and wish to have the Button trigger the UpdatePanel to do an AsycPostBack.

The following example demonstrates setting the <ext:Button> as an AsyncPostBackTrigger on the <asp:UpdatePanel>.

Example

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Button1" />
    </Triggers>
</asp:UpdatePanel>
       
<ext:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" AutoPostBack="true" />

This change to the .AutoPostBack default property value was done to encourage the use of the <AjaxEvents> (server-side) and <Listeners> (client-side> properties.

The following sample demonstrates a simple <Click> AjaxEvent added to an <ext:Button>.

Example

<script runat="server">
    protected void Button1_Click(object sender, AjaxEventArgs e)
    {
        this.Window1.Show();
    }
</script>


<ext:Button ID="Button2" runat="server" Text="Submit">
    <AjaxEvents>
        <Click OnEvent="Button1_Click" />
    </AjaxEvents>
</ext:Button>


The following sample demonstrates the same logic, but using the client-side <Click> Listener.

Example

<ext:Button ID="Button2" runat="server" Text="Submit">
    <Listeners>
        <Click Handler="#{Window1}.show();" />
    </Listeners>
</ext:Button>

Note how in both the above <AjaxEvents> and <Listeners> the .AutoPostBack property is no longer required to be set to "false".

Hope this helps.

--
Geoffrey McGill
Coolite Inc.
Development Team
Skype : geoffrey.mcgill
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
Last Login: 7/2/2010 4:00:04 PM
Posts: 356,
Posted 9/19/2008 12:55:29 PM

Group: Coolite Premium Member & Early Adopter
Cool... Making the simple tasks even simpler... Thanks...

Any news on 6.0 release? Or possible to have latest build from SVN?

Thanks,

Amit Pareek
Web Developer,
CakeWalk IT Solutions
« Prev Topic | Next Topic »
««12
Reading This Topic
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.
All times are GMT -5:00, Time now is 9:59pm