[CLOSED] how to call btn's click event on server by press "enter" key

  1. #1

    [CLOSED] how to call btn's click event on server by press "enter" key

            Ext.getDoc().on('keydown', function (e) {
                if (e.getKey() == e.ENTER) {
                    App.dircect.verycode();  //here I want to call btnLogin's click , how to do thanks.
                   <ext:Button ID="btnLogin" runat="server" Text="登陆" Icon="Accept">
                            <Click OnEvent="btnLogin_Click">
                                <EventMask ShowMask="true" Msg="正在验证..." MinDelay="500" />
            protected void verycode()
                string u = this.txtUsername.Text;
                string p = this.txtPassword.Text;
                if (u == "admin" && p == "XXX")
                    Session["user"] = "admin";
                    X.MessageBox.Alert("提示", "登陆失败").Show();
            protected void btnLogin_Click(object sender, DirectEventArgs e)
    why js show error:
    can not call method 'verycode' of underfinde

    Last edited by hdsoso; May 03, 2013 at 12:02 PM.
  2. #2
    Hi @hdsoso,

    Welcome to the Ext.NET forums!

    You can use the following.
    App.btnLogin.fireEvent("click", btnLogin);
    Another approach is using a DirectMethod. With this approach you should replace the DirectEvent with a combination of the Button's Click Listener and a DirectMethod call. Then you will be able to call that DirectMethod from anywhere.
  3. #3
    thanks.you can close the post.

Similar Threads

  1. [CLOSED] press the ENTER key
    By majunior in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Nov 15, 2012, 11:13 PM
  2. Press Enter key should work on search button
    By Nagaraju in forum 1.x Help
    Replies: 1
    Last Post: Oct 09, 2011, 6:09 PM
  3. Replies: 1
    Last Post: May 25, 2011, 6:06 PM
  4. How do press Enter key jump like Tab?
    By whs2893 in forum 1.x Help
    Replies: 6
    Last Post: Mar 23, 2011, 4:07 AM
  5. [CLOSED] Make enter key activate button click direct event
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 15, 2010, 7:02 PM

Posting Permissions