question

HiteshkumarPatel-3921 avatar image
0 Votes"
HiteshkumarPatel-3921 asked HiteshkumarPatel-3921 commented

OnTextChanged event is not working in my web page

Hi,
i develop one small application to scan barcode i activate AutoPostBack =true but still i need to press enter key or tab to fire trigger.
below is my code

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">;
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
height: 228px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="width: 290px; height: 230px">

     <table id="Table1" runat="server" border="1" style="Z-INDEX: 101; LEFT: 8px; WIDTH: 282px; POSITION: absolute; TOP: 8px; HEIGHT: 64px">
         <tr>
             <td class="style1">
                 <p>
    
     <asp:TextBox ID="TextBox1" runat="server" Width="211px" OnTextChanged="TextBox1_TextChanged" AutoPostBack ="true"></asp:TextBox>
                 </p>
                 <p>
     <asp:Label ID="lblMsg" runat="server" Text="BarCode Allready Scaned" 
         ForeColor="#FF3300" Visible="False"></asp:Label>
                 </p>
                 <p>

&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblScan" runat="server" Text="Total Scan: 0" Font-Bold="True"
ForeColor="Blue"></asp:Label>
</p>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</p>
</td>
</tr>
</table>
<br />
<br />
<script type="text/javascript">
window.onload = function () {
document.getElementById('<%= TextBox1.ClientID%>').focus();
};
</script>
<br />
<br />
<br />
<br />
<br />
<br />

 </div>
 <asp:ListBox ID="ListBox1" runat="server" Width="138px" style="margin-top: 4px">
     </asp:ListBox>    </form>

</body>
</html>

dotnet-aspnet-generaldotnet-aspnet-webformsdotnet-aspnet-webpages
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Be this a desktop program, or web based. The scanner simple types in as if you were using the keyboard the scan results. Most scanners have some settings or options that can (and do) have a termination character. In some cases this can actually be the enter key, tab key, or some other specials character.

You HAVE to go find this special setting on the scanner. So either find what the scanner manual says, or you can often as I stated pick and set and define the termination character on that scanner.

The on change event of a text box does NOT fire until you hit tab key (or often enter key). So, if the scanner can't use tab key, or you can't set the scanner, or you don't want to set the scanner termination character, then you need to get the manual and find out what the default or existing character is. Once you done that, then you probably have to add some JavaScript to the web page that looks for the given key code.
So, every scanner is different, and even worse is that most scanners allow you to SET this termination character, and that knowledge is required to make this work.

Many scanners can provide the tab key, or enter key - but it depends on the scanner. However, quite sure most have some kind of termination character setting by default.

0 Votes 0 ·

Hi @HiteshkumarPatel-3921 ,
What's type of your application? What do you use to scan the barcode? What do you do after scaning?

Best regards,
Yijing Sun

0 Votes 0 ·

i created simple web page created for scanner to scan data and sent to server to check this barcode is there or not if its there then its added to to one table where its showing waiting for dispatch goods from there we make delivery

0 Votes 0 ·

1 Answer

HiteshkumarPatel-3921 avatar image
0 Votes"
HiteshkumarPatel-3921 answered HiteshkumarPatel-3921 commented

Thanks @AlbertKallal-4360 i check and contact scanner Manufacturer and they show me where to set

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @HiteshkumarPatel-3921 ,
So, do you have solved your problems? You codes are right and I think your problem is about scanner.

Best regards,
Yijing Sun

0 Votes 0 ·

Yes Thanks

0 Votes 0 ·