locked
Newbie question RRS feed

  • Question

  • User-1535899909 posted

    Hello,

     I'm a newbie to mobile asp.net programming. All I'm trying to do with my aspx page is to capture and display the key pressed. I get the following error -

    "Can find neither a device capability named 'isHTML32' nor a public non-static method on the page named 'isHTML32' that returns a System.Boolean and takes System.Web.Mobile.MobileCapabilities and System.String as arguments."

    Here's my code below. I'd greatly appreciate any pointers on this:<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %> 

    <mobile:Form id=Form1 runat="server"><mobile:Form id=Form1 runat="server"><%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %>
    <%@ Register
    TagPrefix="Mobile"
    Namespace="System.Web.UI.MobileControls"
    Assembly="System.Web.Mobile" %>
    <html>
     <head>
      <title></title>
      <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
     </head>
     <body> 
     
     <mobile:Form id="Form1" runat="server">               
     <mobile:Panel id="Panel1" runat="server">                       
     <mobile:DeviceSpecific id="DeviceSpecific1" Runat="server">        
        <Choice Filter="isHTML32">
        <contenttemplate>
     <Script Language="javascript">                                     
                     
        document.onkeypress = keyhandler;
     function keyhandler(e)
       {
       Key = window.event.keyCode;
       if (Key != 0){
                 alert("KeyCode Pressed " + Key);                                 
          return(false);
                }
        }
                                                       
     </Script></contenttemplate>
     </Choice>
     </mobile:DeviceSpecific> 
        </mobile:Panel>
        </mobile:Form></mobile:Form></mobile:Form>

    <mobile:Form runat="server"><mobile:Form runat="server"> </body>
    </html>

    </mobile:Form></mobile:Form>

    <mobile:Form runat="server"><mobile:Form runat="server"></mobile:Form></mobile:Form><%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %><%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <META content="Microsoft Visual Studio .NET 7.1" name=GENERATOR> <META content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>

    Friday, April 1, 2005 2:51 PM

All replies

  • User39490543 posted
    In your web.config file have you set up the isHTML32 filter in device filters?

    I believe you should have something like this:
    <system.web>

    <deviceFilters>
    <filter name="isHTML32" compare="PreferredRenderingType" argument="html32" />
    </deviceFilters>

    </system.web>

    Friday, April 1, 2005 3:11 PM
  • User-1535899909 posted

    Thanks TMorton. That has taken care of the error. Now I have another issue. The keypress capture is not working as I had expected it to. From reading topics on other forums such as this:

    http://groups-beta.google.com/group/microsoft.public.dotnet.framework.aspnet.mobile/browse_frm/thread/8bed5c49538757a6/56e4e06cce575c59#56e4e06cce575c59

    I was led to believe that by the example code on that page, which I copied, JavaScript code would work and the keypress value would be captured and displayed.

     What am I missing? Is JavaScript not going to work for a Pocket PC? I'd appreciate any help.

    Thanks

    Friday, April 1, 2005 3:51 PM
  • User39490543 posted
    I am not a mobile development expert.

    Checking the Internet Explorer for Pocket PC - HTML and Object Model Reference, I see no reference to the KeyPress event.  I don't believe this is something you are going to be able to trap -- but again, this is not my area of expertise.
    Friday, April 1, 2005 5:12 PM
  • User-95607119 posted
    On a mobile devices I suggest you to avoid JavaScript etc. Make all processing on server side and expect mobile device only submitting information to you. Don't expect there any high intelligence on client side if you are programming for wide range of devices.

    But, if you still need JavaScript and you run into troubles with it, then try to find documentation for device you are faceing the troubles.
    Saturday, April 2, 2005 6:43 AM