Set Focus on NumberField control.

Page 1 of 3 123 LastLast
  1. #1

    Set Focus on NumberField control.

    Dear Sir,

    I have define a user control. on button click open this control in popup window.
    when we open, I want to set focus on numberfield control.

    I tried with numberfield.focus(), but focus not set on control

    Thanks
    Rupesh
  2. #2
    Hi,

    Please set up
    <Show Handler="NumberField1.focus(100);" />
    for the Window.
  3. #3
    Hi Daniil

    I added this code in window control
    <Listeners>
                    <Show Handler="txtrepeats.focus(100);" />
                </Listeners>
    while opening window, following is the code

    winNewset.Hidden = false;
            winNewset.Modal = true;
            ucNewSet.SetInitPara(Convert.ToInt32(hdCoachSummID.Value),0,_inextWL);
    SetInitPara is usercontrol function.

    focus is not set on control.

    please help me.

    Thanks
    Rupesh
  4. #4
    You should use a client id of NumberField.

    Please try:
    <Show Handler="#{txtrepeats}.focus(100);" />
  5. #5
    Quote Originally Posted by Daniil View Post
    You should use a client id of NumberField.

    Please try:
    <Show Handler="#{txtrepeats}.focus(100);" />
    Hi Daniil

    I already try this one. but not working.

    Thanks
    Rupesh
  6. #6
    Please provide a sample to reproduce.
  7. #7
    Hi Daniil,

    Sample code as follows.

    aspx page code
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <%@ Register TagName="NewSets" TagPrefix="uc" Src="ucsamplefocus.ascx" %>
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" IDMode="Explicit" InitScriptMode="Linked" RemoveViewState="true" Namespace="CompanyX"  />
        <div>
            <ext:FormPanel runat="server">
                <Items>
                    <ext:Button runat="server" ID="btn" Text="Open Window">
                        <DirectEvents>
                            <Click OnEvent="OpenWindow"></Click>
                        </DirectEvents>
                    </ext:Button>
                </Items>
            </ext:FormPanel>
            <ext:Window runat="server" Title="New Set" ID="winNewset" Hidden="true" Height="300" Width="400">
                <Content>
                    <uc:NewSets runat="server" ID="ucNewSet" />
                </Content>
                <Listeners>
                    <Show Handler="txtrepeats.focus(100);" />
                </Listeners>
                
            </ext:Window>
        </div>
        </form>
    </body>
    </html>
    cs file code
    protected void OpenWindow(object sender, DirectEventArgs e)
        {
            winNewset.Hidden = false;
            winNewset.Modal = true;
        }
    user control code
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <ext:FormPanel runat="server" ID="frmWorkouts" >
                <Items>
                    <ext:NumberField runat="server" ID="txtrepeats" FieldLabel="Repeats" AllowDecimals="false"
                        MaxLength="5" AllowNegative="false" Width="257px" >
                    </ext:NumberField>
                    <ext:NumberField AllowBlank="false" runat="server" ID="txtDistance" FieldLabel="Distance"
                        AllowDecimals="false" AllowNegative="false" MaxLength="8" Width="257px">
                    </ext:NumberField>
                    <ext:CompositeField runat="server" FieldLabel="Interval">
                        <Items>
                            <ext:NumberField runat="server" ID="txtIntervals" FieldLabel="Interval" AllowDecimals="false" 
                                MaxLength="2" AllowNegative="false" Width="100px" Note="min (0-30)" NoteCls="NoteFont" MaxValue="30" MinValue="0">
                            </ext:NumberField>
                            <ext:NumberField runat="server" ID="txtIntervalssec" FieldLabel="Interval" AllowDecimals="false" 
                                MaxLength="2" AllowNegative="false" Width="100px" Note="sec (0-59)" NoteCls="NoteFont" MaxValue="59" MinValue="0">
                            </ext:NumberField>
                        </Items>
                    </ext:CompositeField>
                    
                    <ext:TextField AllowBlank="false" runat="server" ID="txtDescription" FieldLabel="Description"
                        MaxLength="500" Width="257px">
                    </ext:TextField>
                    <ext:TextField runat="server" ID="txtNotes" FieldLabel="Notes" MaxLength="1000" Width="257px">
                    </ext:TextField>
                    
                </Items>
                
               
            </ext:FormPanel>
    thanks
    Rupesh
  8. #8
    Please follow:

    1. Wrap the FormPanel in a FitLayout control.

    Example
    <ext:FitLayout runat="server">
        <Items>
            <ext:FormPanel runat="server" ID="frmWorkouts" >
                ...
            </ext:FormPanel>
        </Items>
    </ext:FitLayout>
    2. Set up
    <Show Handler="this.items.get(0).items.get(0).focus(100);" />
    for the Window.
  9. #9
    Hi Daniil

    Not working for me.

    Thanks
    Rupesh
  10. #10
    What browser are you testing with?
Page 1 of 3 123 LastLast

Similar Threads

  1. numberfield control and decimal separator
    By cperriot in forum 1.x Help
    Replies: 0
    Last Post: Jul 17, 2012, 2:36 PM
  2. Focus from las control to first one
    By Dominik in forum 1.x Help
    Replies: 5
    Last Post: Feb 16, 2012, 1:28 PM
  3. Replies: 1
    Last Post: Dec 01, 2011, 11:34 AM
  4. Replies: 1
    Last Post: Nov 28, 2011, 2:40 PM
  5. [CLOSED] NumberField control
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 20, 2011, 2:01 PM

Posting Permissions