SetFocus on Load

Discussion in 'ASP .Net Mobile' started by Don Schilling, Nov 10, 2004.

  1. How can I set the focus on a textbox for Pocket PC mobile 2003?
    On load I would like focus on text box so a bar code can be scanned without
    any keypading.
    I'm currently using C# in Visual Studio to create either a mobile or web
    app.
    I've tried javascript, looked at WML, but no luck.
    As a side note, I cant seem to find a definitve answer to what javascript is
    supported on Pocket PC.
    Because of the device I'm using, a Symbol device using a an ARM Xscale
    processor, I havent been able to find a third party browser.
    Below is the java script I've tried. tbScan is the textbox I would like to
    have focus.
    I've spent a good chunk of time searching the web for an answer, but most of
    the stuff out there is half baked.
    TIA
    Don

    System.Text.StringBuilder sb = new System.Text.StringBuilder("");

    sb.Append("<script language='JavaScript'>");

    sb.Append("document.getElementById('" + this.tbScan.ClientID +
    "').focus();<");

    sb.Append("/");

    sb.Append("script>");

    if (!IsStartupScriptRegistered("Focus"))

    {

    this.RegisterStartupScript("Focus", sb.ToString());

    }
     
    Don Schilling, Nov 10, 2004
    #1
    1. Advertising

  2. Don Schilling

    William Main Guest

    It appears as though JavaScript is not exported to the web page from the aspx
    age. I've even hard coded script into the aspx page and no luck, the HTML
    page has no script in it. I suspect it has to do with the xml.dtd that is
    referenced in the generated HTML page (also not ther is never a <HTML></HTML>
    tag pair in the output either).

    I've had to resort to using standard ASPX and not the MOBILE ASPX page type.

    William main

    "Don Schilling" wrote:

    > How can I set the focus on a textbox for Pocket PC mobile 2003?
    > On load I would like focus on text box so a bar code can be scanned without
    > any keypading.
    > I'm currently using C# in Visual Studio to create either a mobile or web
    > app.
    > I've tried javascript, looked at WML, but no luck.
    > As a side note, I cant seem to find a definitve answer to what javascript is
    > supported on Pocket PC.
    > Because of the device I'm using, a Symbol device using a an ARM Xscale
    > processor, I havent been able to find a third party browser.
    > Below is the java script I've tried. tbScan is the textbox I would like to
    > have focus.
    > I've spent a good chunk of time searching the web for an answer, but most of
    > the stuff out there is half baked.
    > TIA
    > Don
    >
    > System.Text.StringBuilder sb = new System.Text.StringBuilder("");
    >
    > sb.Append("<script language='JavaScript'>");
    >
    > sb.Append("document.getElementById('" + this.tbScan.ClientID +
    > "').focus();<");
    >
    > sb.Append("/");
    >
    > sb.Append("script>");
    >
    > if (!IsStartupScriptRegistered("Focus"))
    >
    > {
    >
    > this.RegisterStartupScript("Focus", sb.ToString());
    >
    > }
    >
    >
    >
     
    William Main, Nov 21, 2004
    #2
    1. Advertising

  3. Using aspx rather than mobile wont help in this case. Java script is not
    supported on the client, so it dosent matter what server method is used.



    "William Main" <> wrote in message
    news:...
    > It appears as though JavaScript is not exported to the web page from the

    aspx
    > age. I've even hard coded script into the aspx page and no luck, the HTML
    > page has no script in it. I suspect it has to do with the xml.dtd that is
    > referenced in the generated HTML page (also not ther is never a

    <HTML></HTML>
    > tag pair in the output either).
    >
    > I've had to resort to using standard ASPX and not the MOBILE ASPX page

    type.
    >
    > William main
    >
    > "Don Schilling" wrote:
    >
    > > How can I set the focus on a textbox for Pocket PC mobile 2003?
    > > On load I would like focus on text box so a bar code can be scanned

    without
    > > any keypading.
    > > I'm currently using C# in Visual Studio to create either a mobile or web
    > > app.
    > > I've tried javascript, looked at WML, but no luck.
    > > As a side note, I cant seem to find a definitve answer to what

    javascript is
    > > supported on Pocket PC.
    > > Because of the device I'm using, a Symbol device using a an ARM Xscale
    > > processor, I havent been able to find a third party browser.
    > > Below is the java script I've tried. tbScan is the textbox I would like

    to
    > > have focus.
    > > I've spent a good chunk of time searching the web for an answer, but

    most of
    > > the stuff out there is half baked.
    > > TIA
    > > Don
    > >
    > > System.Text.StringBuilder sb = new System.Text.StringBuilder("");
    > >
    > > sb.Append("<script language='JavaScript'>");
    > >
    > > sb.Append("document.getElementById('" + this.tbScan.ClientID +
    > > "').focus();<");
    > >
    > > sb.Append("/");
    > >
    > > sb.Append("script>");
    > >
    > > if (!IsStartupScriptRegistered("Focus"))
    > >
    > > {
    > >
    > > this.RegisterStartupScript("Focus", sb.ToString());
    > >
    > > }
    > >
    > >
    > >
     
    Don Schilling, Nov 22, 2004
    #3
    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. Jurjen de Groot

    SetFocus

    Jurjen de Groot, Jun 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    632
    dmedina
    Jun 30, 2003
  2. jamess

    asp setfocus and performance

    jamess, Oct 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    449
    Saravana [MVP]
    Oct 30, 2003
  3. jaffer the but

    setfocus eh ! help

    jaffer the but, Apr 14, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    548
    Lars Netzel
    Apr 14, 2004
  4. Mad Scientist Jr

    asp.net setfocus after validation not working

    Mad Scientist Jr, Jul 13, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    6,787
    Mad Scientist Jr
    Jul 15, 2004
  5. JC
    Replies:
    2
    Views:
    9,358
Loading...

Share This Page