Still unable to make login button as default button

  1. #1

    Still unable to make login button as default button

    I tried with the code u given here as same in my asp.net mvc application. But still it is not working and am getting the error like below.
    "Property 'KeyMap' does not have a property named 'Target'."

    Please find the complete code of Login page which i developed.
    Please can anyone solve my problem as early as possible. Because it is urgent.
    Thanks in advance..

    <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Ext.Net.MVC.Demo.Models.LoginModel>" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>CCUBE - POC application</title>
        <style type="text/css">
            h1
            {
                font: normal 60px tahoma, arial, verdana;
                color: #E1E1E1;
            }
            
            h2
            {
                font: normal 20px tahoma, arial, verdana;
                color: #E1E1E1;
            }
            
            h2 a
            {
                text-decoration: none;
                color: #E1E1E1;
            }
            
            .x-window-mc
            {
                background-color: #F4F4F4 !important;
            }
        </style>
        <script type="text/javascript">
            if (window.top.frames.length !== 0) {
                window.top.location = self.document.location;
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <%= ViewData["Message"] %>
        <h1>
            CCUBE</h1>
        <h2>
        </h2>
        <ext:Window ID="LoginWindow" runat="server" Closable="false" Resizable="false" Height="130"
            Icon="Lock" Title="Login" Draggable="true" Width="300" Modal="true" Layout="fit"
            BodyBorder="false" Padding="5">
            <Items>
                <ext:FormPanel ID="PnlLogin" runat="server" FormID="form1" Border="false" Layout="form"
                    BodyBorder="false" BodyStyle="background:transparent;">
                    <%--Url='<%# Html.AttributeEncode(Url.Action("Login")) %>'--%>
                    <Items>
                        <ext:TextField ID="txtUsername" runat="server" FieldLabel="Username" AllowBlank="false"
                            BlankText="Username is required." AnchorHorizontal="100%" />
                        <ext:TextField ID="txtPassword" runat="server" InputType="Password" FieldLabel="Password"
                            AllowBlank="false" BlankText="Password is required." AnchorHorizontal="100%" />
                    </Items>
                    <Buttons>
                        <ext:Button ID="btnLogin" runat="server" Text="Login" Icon="Accept">
                            <DirectEvents>
                                <Click Url="/Account/Login/" Timeout="60000" FormID="form1" CleanRequest="true" Method="POST"
                                    Before="Ext.Msg.wait('Verifying...', 'Authentication');" Failure="Ext.Msg.show({
                               title:   'Login Error',
                               msg:     result.errorMessage,
                               buttons: Ext.Msg.OK,
                               icon:    Ext.MessageBox.ERROR
                            });">
                                    <EventMask MinDelay="250" ShowMask="false" Target="CustomTarget" CustomTarget="={#{PnlLogin}.getEl()}" />
                                    <ExtraParams>
                                        <ext:Parameter Name="ReturnUrl" Value="Ext.urlDecode(String(document.location).split('?')[1]).r || '/'"
                                            Mode="Raw" />
                                    </ExtraParams>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Buttons>
                </ext:FormPanel>
            </Items>
            <ext:KeyMap runat="server" Target="={PnlLogin.getBody()}">
                <ext:KeyBinding>
                    <Keys>
                        <ext:Key Code="ENTER" />
                    </Keys>
                    <Listeners>
                        <Event Handler="e.stopEvent();#{BtnLogin}.fireEvent('click');" />
                    </Listeners>
                </ext:KeyBinding>
            </ext:KeyMap>
        </ext:Window>
    </body>
    </html>
    Last edited by geoffrey.mcgill; Feb 06, 2015 at 11:46 PM.
  2. #2
    If I understand correctly is that when entered is pressed the login button must be executed If so use the following code.

    <ext:KeyNav ID="KeyNav3" runat="server" Target="={#{PnlLogin}.body}" DefaultEventAction="StopEvent">
    <Enter Handler="btnLogin.fireEvent('click');" />
    Last edited by geoffrey.mcgill; Feb 06, 2015 at 11:47 PM.
  3. #3
    sorry for the previous garbage

    <ext:KeyNav ID="KeyNav3" runat="server" Target="={#{PnlLogin}.body}" DefaultEventAction="StopEvent">
    <Enter Handler="btnLogin.fireEvent('click');" />
  4. #4

    Helped me

    Thanks, It helped me to solve my prob.
    Regards,
    Santhosh

    Quote Originally Posted by Richardt View Post
    sorry for the previous garbage

    <ext:KeyNav ID="KeyNav3" runat="server" Target="={#{PnlLogin}.body}" DefaultEventAction="StopEvent">
    <Enter Handler="btnLogin.fireEvent('click');" />

Similar Threads

  1. Replies: 1
    Last Post: Apr 14, 2011, 5:36 PM
  2. Panel Default Button
    By speddi in forum 1.x Help
    Replies: 8
    Last Post: May 23, 2010, 7:32 PM
  3. [CLOSED] How to make a button bar less width?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 27, 2010, 4:17 AM
  4. Replies: 3
    Last Post: Feb 02, 2010, 6:32 PM
  5. [CLOSED] Default button
    By jchau in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 08, 2008, 5:51 PM

Posting Permissions