Setting focus..?

Discussion in 'ASP .Net Datagrid Control' started by Kent Johnson, Oct 26, 2003.

  1. Kent Johnson

    Kent Johnson Guest

    Hi all,

    I have a Webform with some textboxes on.
    How can I set the focus so that a user can start the input directly in the
    first textbox in taborder when the forms open? Textbox1 har the taborder set
    to 1 but the user still have to push the tab-button twice before TextBox1
    gets the focus.


    /Kent J.
     
    Kent Johnson, Oct 26, 2003
    #1
    1. Advertising

  2. Kent Johnson

    Rich Miller Guest

    You may want to check out the FirstFocus control at
    http://www.metabuilders.com/Tools/BoundLookupColumn.aspx

    Let me know how this works for you,

    Rich

    "Kent Johnson" <> wrote in message
    news:gtQmb.31138$...
    > Hi all,
    >
    > I have a Webform with some textboxes on.
    > How can I set the focus so that a user can start the input directly in the
    > first textbox in taborder when the forms open? Textbox1 har the taborder

    set
    > to 1 but the user still have to push the tab-button twice before TextBox1
    > gets the focus.
    >
    >
    > /Kent J.
    >
    >
     
    Rich Miller, Oct 26, 2003
    #2
    1. Advertising

  3. Kent Johnson

    Rich Miller Guest

    Kent,

    Check this out also
    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPostback.aspx

    Rich

    "Kent Johnson" <> wrote in message
    news:gtQmb.31138$...
    > Hi all,
    >
    > I have a Webform with some textboxes on.
    > How can I set the focus so that a user can start the input directly in the
    > first textbox in taborder when the forms open? Textbox1 har the taborder

    set
    > to 1 but the user still have to push the tab-button twice before TextBox1
    > gets the focus.
    >
    >
    > /Kent J.
    >
    >
     
    Rich Miller, Oct 26, 2003
    #3
  4. Kent Johnson

    Kent Johnson Guest

    Rich,

    Sorry, I did't get it to work.
    This is what I tried:
    .....
    <HTML>
    <script language=javascript>
    <!--
    document.forms[0].Textbox1.focus();
    //-->
    </script>
    .......


    "Rich Miller" <> wrote in message
    news:...
    > Kent,
    >
    > Check this out also
    >

    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPostback.aspx
    >
    > Rich
    >
    > "Kent Johnson" <> wrote in message
    > news:gtQmb.31138$...
    > > Hi all,
    > >
    > > I have a Webform with some textboxes on.
    > > How can I set the focus so that a user can start the input directly in

    the
    > > first textbox in taborder when the forms open? Textbox1 har the taborder

    > set
    > > to 1 but the user still have to push the tab-button twice before

    TextBox1
    > > gets the focus.
    > >
    > >
    > > /Kent J.
    > >
    > >

    >
    >
     
    Kent Johnson, Oct 26, 2003
    #4
  5. Check out this code snippet
    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPos
    tback.aspx

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "Kent Johnson" <> wrote in message
    news:SyTmb.31180$...
    > Rich,
    >
    > Sorry, I did't get it to work.
    > This is what I tried:
    > ....
    > <HTML>
    > <script language=javascript>
    > <!--
    > document.forms[0].Textbox1.focus();
    > //-->
    > </script>
    > ......
    >
    >
    > "Rich Miller" <> wrote in message
    > news:...
    > > Kent,
    > >
    > > Check this out also
    > >

    >

    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPos
    tback.aspx
    > >
    > > Rich
    > >
    > > "Kent Johnson" <> wrote in message
    > > news:gtQmb.31138$...
    > > > Hi all,
    > > >
    > > > I have a Webform with some textboxes on.
    > > > How can I set the focus so that a user can start the input directly in

    > the
    > > > first textbox in taborder when the forms open? Textbox1 har the

    taborder
    > > set
    > > > to 1 but the user still have to push the tab-button twice before

    > TextBox1
    > > > gets the focus.
    > > >
    > > >
    > > > /Kent J.
    > > >
    > > >

    > >
    > >

    >
    >
     
    Saravana [MVP], Oct 27, 2003
    #5
  6. Kent Johnson

    Kent Johnson Guest

    Saravana,

    I'm getting: 'The page cannot be found'

    /Kent J.

    "Saravana [MVP]" <> wrote in message
    news:...
    > Check out this code snippet
    >

    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPos
    > tback.aspx
    >
    > --
    > Saravana
    > Microsoft MVP - ASP.NET
    > www.extremeexperts.com
    >
    >
    >
    > "Kent Johnson" <> wrote in message
    > news:SyTmb.31180$...
    > > Rich,
    > >
    > > Sorry, I did't get it to work.
    > > This is what I tried:
    > > ....
    > > <HTML>
    > > <script language=javascript>
    > > <!--
    > > document.forms[0].Textbox1.focus();
    > > //-->
    > > </script>
    > > ......
    > >
    > >
    > > "Rich Miller" <> wrote in message
    > > news:...
    > > > Kent,
    > > >
    > > > Check this out also
    > > >

    > >

    >

    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPos
    > tback.aspx
    > > >
    > > > Rich
    > > >
    > > > "Kent Johnson" <> wrote in message
    > > > news:gtQmb.31138$...
    > > > > Hi all,
    > > > >
    > > > > I have a Webform with some textboxes on.
    > > > > How can I set the focus so that a user can start the input directly

    in
    > > the
    > > > > first textbox in taborder when the forms open? Textbox1 har the

    > taborder
    > > > set
    > > > > to 1 but the user still have to push the tab-button twice before

    > > TextBox1
    > > > > gets the focus.
    > > > >
    > > > >
    > > > > /Kent J.
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Kent Johnson, Oct 27, 2003
    #6
  7. The following should do it.

    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5"
    name="vs_targetSchema">
    <SCRIPT LANGUAGE="JavaScript">
    function setFocus()
    {
    document.Form1('TextBox1').focus();
    }

    </SCRIPT>
    </HEAD>
    <body MS_POSITIONING="GridLayout" onload="setFocus();">
    <form id="Form1" method="post" runat="server" >
    <asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 275px; POSITION:
    absolute; TOP: 100px" runat="server"></asp:TextBox>
    <asp:TextBox id="TextBox2" style="Z-INDEX: 102; LEFT: 277px; POSITION:
    absolute; TOP: 134px" runat="server"></asp:TextBox>
    <asp:TextBox id="TextBox3" style="Z-INDEX: 103; LEFT: 278px; POSITION:
    absolute; TOP: 171px" runat="server"></asp:TextBox></form>
    </body>
    </HTML>


    Hope this Helps.
    Imtiaz Hussain.
     
    Imtiaz Hussain, Oct 29, 2003
    #7
  8. I think url is splitted into two lines, check out that
    www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPostback.a
    spx

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "Kent Johnson" <> wrote in message
    news:Ebenb.31360$...
    > Saravana,
    >
    > I'm getting: 'The page cannot be found'
    >
    > /Kent J.
    >
    > "Saravana [MVP]" <> wrote in message
    > news:...
    > > Check out this code snippet
    > >

    >

    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPos
    > > tback.aspx
    > >
    > > --
    > > Saravana
    > > Microsoft MVP - ASP.NET
    > > www.extremeexperts.com
    > >
    > >
    > >
    > > "Kent Johnson" <> wrote in message
    > > news:SyTmb.31180$...
    > > > Rich,
    > > >
    > > > Sorry, I did't get it to work.
    > > > This is what I tried:
    > > > ....
    > > > <HTML>
    > > > <script language=javascript>
    > > > <!--
    > > > document.forms[0].Textbox1.focus();
    > > > //-->
    > > > </script>
    > > > ......
    > > >
    > > >
    > > > "Rich Miller" <> wrote in message
    > > > news:...
    > > > > Kent,
    > > > >
    > > > > Check this out also
    > > > >
    > > >

    > >

    >

    http://www.extremeexperts.com/Net/CodeSnippets/SettingFocustoElementAfterPos
    > > tback.aspx
    > > > >
    > > > > Rich
    > > > >
    > > > > "Kent Johnson" <> wrote in message
    > > > > news:gtQmb.31138$...
    > > > > > Hi all,
    > > > > >
    > > > > > I have a Webform with some textboxes on.
    > > > > > How can I set the focus so that a user can start the input

    directly
    > in
    > > > the
    > > > > > first textbox in taborder when the forms open? Textbox1 har the

    > > taborder
    > > > > set
    > > > > > to 1 but the user still have to push the tab-button twice before
    > > > TextBox1
    > > > > > gets the focus.
    > > > > >
    > > > > >
    > > > > > /Kent J.
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Saravana [MVP], Oct 30, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason
    Replies:
    4
    Views:
    1,666
    Jason
    May 7, 2007
  2. Replies:
    2
    Views:
    351
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  3. Roger
    Replies:
    3
    Views:
    361
  4. Jeff

    manual focus vs. focus()

    Jeff, May 20, 2007, in forum: Javascript
    Replies:
    4
    Views:
    192
  5. Spizzat2
    Replies:
    2
    Views:
    193
    Spizzat2
    Jan 9, 2008
Loading...

Share This Page