[ADDED] [V0.6] HiddenField AjaxEvents and Listeners

  1. #1

    [ADDED] [V0.6] HiddenField AjaxEvents and Listeners

    Hello,

    Would it be possible to get AjaxEvents added to the Ext:Hidden field so that an event can be fired when the value changes on the client-side ?

    Would be proper cool!

    Cheers,
    Timothy
  2. #2

    RE: [ADDED] [V0.6] HiddenField AjaxEvents and Listeners

    Quick update: I have the <Change> Listener and AjaxEvent working, just need to do some more testing and will commit to svn tomorrow.*

    Geoffrey McGill
    Founder
  3. #3

    RE: [ADDED] [V0.6] HiddenField AjaxEvents and Listeners

    Hi Timothy,

    The <Change> Listener and AjaxEvent has been added to the <ext:Hidden> Field control.

    The following sample demonstrates using a <Click> Listener on an <ext:Button> to set the value of a <ext:Hidden> field, which then automatically fires a <Change> AjaxEvent. Within the Hidden1_Change event on the server I set the .Text property of an <ext:Label>.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
        protected void Hidden1_Change(object sender, AjaxEventArgs e)
        {
            this.Label1.Text = "The HiddenField was updated: " + this.Hidden1.Value.ToString();
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    </head>
    <body>
        <p><a href="AjaxEvent.aspx">Reload</a></p>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Hidden ID="Hidden1" runat="server">
                <AjaxEvents>
                    <Change OnEvent="Hidden1_Change" />
                </AjaxEvents>
            </ext:Hidden>
            
            <ext:Button 
                ID="Button1" 
                runat="server" 
                Text="Submit"
                AutoPostBack="false">
                <Listeners>
                    <Click Handler="#{Hidden1}.setValue('Testing...');" />
                </Listeners>
            </ext:Button>
                
            <ext:Label ID="Label1" runat="server" />
        </form>
    </body>
    </html>
    Thanks for pointing out this functionality was missing.

    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] Listeners added for button at code behind is not working
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 31, 2012, 3:32 PM
  2. Replies: 0
    Last Post: Apr 04, 2011, 6:05 PM
  3. HiddenField Losing Value
    By hbbazan in forum 1.x Help
    Replies: 0
    Last Post: Dec 11, 2009, 3:07 PM
  4. [CLOSED] Listeners + AjaxEvents
    By state in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 07, 2009, 7:26 AM
  5. Replies: 2
    Last Post: Oct 27, 2008, 7:14 PM

Posting Permissions