[CLOSED] How to fire the event "OnDirectChange" when the enter key is pressed?

  1. #1

    [CLOSED] How to fire the event "OnDirectChange" when the enter key is pressed?

    Hi,

    I am using the event OnDirectChange to call the method "FilterCodeField_Change", it works fine when I press the tab key to go to other field after the field is changed, but when I press the enter key it does not work.

    Is it there any way to fire this event when the enter key is pressed?

    protected void FilterCodeField_Change(object sender, DirectEventArgs e)
    {
        string code = this.FilterCodeField.Text;
        string name = this.FilterNameField.Text;
    }
    
    <ext:FormLayout ID="FormLayout5" runat="server" LabelAlign="Top">
        <Anchors>
            <ext:Anchor>
                <ext:TextField 
                    ID="FilterNameField" 
                    Width="240px"
                    runat="server" 
                    FieldLabel="Name"
                    OnDirectChange="FilterCodeField_Change" 
                    />
            </ext:Anchor>
        </Anchors>
    </ext:FormLayout>
  2. #2

    RE: [CLOSED] How to fire the event "OnDirectChange" when the enter key is pressed?

    Hi,

    Just add the following DirectEvent to the combo

    <DirectEvents>
        <SpecialKey Before="return e.getKey() == Ext.EventObject.ENTER;" OnEvent="FilterCodeField_Change"/>
    </DirectEvents>

Similar Threads

  1. Replies: 4
    Last Post: Nov 19, 2010, 1:39 PM
  2. Replies: 3
    Last Post: Aug 27, 2010, 9:30 PM
  3. Replies: 2
    Last Post: Feb 01, 2010, 1:00 PM
  4. Replies: 3
    Last Post: Mar 10, 2009, 11:56 AM

Posting Permissions