0

Currently trying to fix an ASP.NET web application. Everything works fine, except being able to press the "enter" or "return" key to submit the form, from a Windows Mobile 5.0 device.

Basically, the site has one text box (the search box) and one button that has a PostBackUrl attached to it. Pressing the button works fine, but the device that is being used, mainly, has a big enter key as well as a scanner that uses the "enter" or "return" function. When the "enter" key is pressed down, or a scan is made and "enter" is passed along, it appears to refresh the page but will not submit.

I have tried numerous suggestions such as: defaultbutton attribute, wrapping in a panel and designating defaultbutton, javascript, usesubmitbehavior, and more. I have spent hours on this and haven't gotten anywhere. Your help is greatly appreciated!

I have taken everything back down to the base code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="searchcode.aspx.cs" Inherits="search_inventory_control_searchcode" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .auto-style1 {
            text-align: center;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server" defaultfocus="CodeSearchBox" defaultbutton="SearchButton">
        <div class="auto-style1">
            <a href="index.aspx">
                <asp:Image ID="Image1" runat="server" ImageUrl="~/images/logo.png" />
            </a>
        </div>
        <p class="auto-style1">
            <strong>Search Inventory by Product Code</strong></p>
        <p class="auto-style1">
            <asp:TextBox ID="CodeSearchBox" runat="server" Width="180px"></asp:TextBox>
        </p>
        <p class="auto-style1">
            <asp:Button ID="SearchButton" runat="server" Text="Search" Width="180px" Height="30px" PostBackUrl="~/search/inventory_control/resultscode.aspx" />
        </p>
        </div>
    </form>
</body>
</html>
scedsh8919
  • 131
  • 1
  • 1
  • 10
  • Couple of things to consider: 1. Does the page/form correctly have focus when the scanner sends the enter/return function? 2. Which version of .NET are you using? It's possible that it is considering your device a "downlevel" browser and not wiring up the JS correctly. You can force this to use the more recent tag writer [via updated browser caps](https://stackoverflow.com/a/431991/33051) – Zhaph - Ben Duguid Dec 18 '17 at 22:27
  • 1
    The site works as expected with the exception of being able to press the "enter" or "return" button. The site loads, I can key-in a product code, and press the on-screen search button and it returns the desired results. When I scan a barcode, it scans as expected, inputs the data into the text box, but when it attempts to pass an "enter" or "return" command, it doesn't work, nor does the actual enter button on the keypad. I am using .NET 4.0. – scedsh8919 Dec 18 '17 at 22:41
  • Checking my default files, .NET 4.0 still uses the browser capabilities features, and would almost certainly consider IE on Windows Mobile 5 as "downlevel". You could try switching the tagwriter in a local browser caps file to use the more recent one (`tagwriter=System.Web.UI.HtmlTextWriter`) and see if that works for you? – Zhaph - Ben Duguid Dec 18 '17 at 22:54
  • Not having any luck with this. I've even went back through and re-did a couple of pages in dotNet 2.0 and still the same issues. – scedsh8919 Dec 19 '17 at 00:51

0 Answers0