locked
Focus() function RRS feed

  • Question

  • User-790167105 posted
    How to use setfocus in mobile asp.net page? I tried set the focus to a control. the system showed that "A form tag with runat=server must exist on the Page to use SetFocus() or the Focus property."
    May I use focus property in a mobile web page
    Thanks
    Thursday, August 31, 2006 9:42 PM

All replies

  • User-2041805088 posted

    I know that the version of Internet Explorer Mobile I have on my PDA phone doesn't support JavaScript, so that could be another thing to look into.

    Ryan 

    Saturday, September 2, 2006 12:09 AM
  • User-225480610 posted
    I am having the same problem.  The focus() method causes the error above and trying it with a registered startup javascript fails because ASP doesn't serve up the script (but does serve its own script up).  The mobile device supports javascript.  Was there an answer to the problem?
    Thursday, November 23, 2006 4:43 AM
  • User2026204247 posted

    Hi!

    If you have JavaScript support in you browser try this: 

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
    
    <!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>
        <title>Untitled</title>
    </head>
    <body>
        <form id="myForm" runat="server">
            <input id="myEdit0" type="text" value="" />
            <input id="myEdit1" type="text" value="" />
            <input id="myEdit2" type="text" value="" />
        </form>
    
        <script type="text/javascript">myForm.myEdit1.focus()</script>
    
    </body>
    </html>
    

    This example working in Windows Mobile 5.

    Best Regards.

    Igor. 

    Friday, November 24, 2006 5:05 AM
  • User-225480610 posted

    The solution is in this thread...

     [url]http://forums.asp.net/thread/1472573.aspx[/url]


     

    Tuesday, January 2, 2007 8:28 AM